fix ServiceInfo for plpid, and revert unnecessary fixes.
[vuplus_dvbapp] / lib / python / Components / NimManager.py
old mode 100644 (file)
new mode 100755 (executable)
index d8a7c5c..be28293
@@ -118,8 +118,11 @@ class SecConfigure:
 
        def linkNIMs(self, sec, nim1, nim2):
                print "link tuner", nim1, "to tuner", nim2
-               if nim2 == (nim1 - 1):
-                       self.linkInternally(nim1)
+#              if nim2 == (nim1 - 1):
+#                      self.linkInternally(nim1)
+#
+# for internally connect tuner A to B
+               self.linkInternally(nim1)
                sec.setTunerLinked(nim1, nim2)
                
        def getRoot(self, slotid, connto):
@@ -150,7 +153,7 @@ class SecConfigure:
 
                for slot in nim_slots:
                        if slot.type is not None:
-                               used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2"), slot.frontend_id is None and -1 or slot.frontend_id))
+                               used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2"), slot.isCompatible("DVB-T2"), slot.frontend_id is None and -1 or slot.frontend_id))
                eDVBResourceManager.getInstance().setFrontendSlotInformations(used_nim_slots)
 
                for slot in nim_slots:
@@ -390,6 +393,7 @@ class SecConfigure:
 
                                        if currLnb.diseqcMode.value == "1_0":
                                                currCO = currLnb.commandOrder1_0.value
+                                               sec.setRepeats(0)
                                        else:
                                                currCO = currLnb.commandOrder.value
 
@@ -484,7 +488,7 @@ class NIM(object):
        def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}, frontend_id = None, i2c = None, is_empty = False):
                self.slot = slot
 
-               if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None):
+               if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", "DVB-T2", None):
                        print "warning: unknown NIM type %s, not using." % type
                        type = None
 
@@ -505,7 +509,8 @@ class NIM(object):
                                "DVB-S": ("DVB-S", None),
                                "DVB-C": ("DVB-C", None),
                                "DVB-T": ("DVB-T", None),
-                               "DVB-S2": ("DVB-S", "DVB-S2", None)
+                               "DVB-S2": ("DVB-S", "DVB-S2", None),
+                               "DVB-T2": ("DVB-T", "DVB-T2", None)
                        }
                return what in compatible[self.type]
        
@@ -517,7 +522,8 @@ class NIM(object):
                                "DVB-S": ("DVB-S", "DVB-S2"),
                                "DVB-C": ("DVB-C",),
                                "DVB-T": ("DVB-T",),
-                               "DVB-S2": ("DVB-S", "DVB-S2")
+                               "DVB-S2": ("DVB-S", "DVB-S2"),
+                               "DVB-T2": ("DVB-T", "DVB-T2",)
                        }
                return connectable[self.type]
 
@@ -571,8 +577,9 @@ class NIM(object):
                return {
                        "DVB-S": "DVB-S", 
                        "DVB-T": "DVB-T",
-                       "DVB-S2": "DVB-S2",
                        "DVB-C": "DVB-C",
+                       "DVB-S2": "DVB-S2",
+                       "DVB-T2": "DVB-T2",
                        None: _("empty")
                        }[self.type]
 
@@ -837,6 +844,8 @@ class NimManager:
                type = self.getNimType(slotid)
                if type == "DVB-S2":
                        type = "DVB-S"
+               elif type == "DVB-T2":
+                       type = "DVB-T"
                nimList = self.getNimListOfType(type, slotid)
                for nim in nimList[:]:
                        mode = self.getNimConfig(nim)
@@ -848,6 +857,8 @@ class NimManager:
                type = self.getNimType(slotid)
                if type == "DVB-S2":
                        type = "DVB-S"
+               elif type == "DVB-T2":
+                       type = "DVB-T"
                nimList = self.getNimListOfType(type, slotid)
                positionerList = []
                for nim in nimList[:]:
@@ -1360,25 +1371,32 @@ def InitNimManager(nimmgr):
                slot_id = configElement.slot_id
                if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2':
                        open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value)
-                       
+
        def tunerTypeChanged(nimmgr, configElement):
                fe_id = configElement.fe_id
-               print "tunerTypeChanged feid %d to mode %s" % (fe_id, configElement.value)
-               try:
-                       oldvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline()
-                       open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0")
-               except:
-                       print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
-               frontend = eDVBResourceManager.getInstance().allocateRawChannel(fe_id).getFrontend()
-               frontend.closeFrontend()
-               open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value)
-               frontend.reopenFrontend()
-               try:
-                       open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(oldvalue)
-               except:
-                       print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
-               nimmgr.enumerateNIMs()
-       
+
+               cur_type = int(open("/proc/stb/frontend/%d/mode" % (fe_id), "r").read())
+               if cur_type != int(configElement.value):
+                       print "tunerTypeChanged feid %d from %d to mode %d" % (fe_id, cur_type, int(configElement.value))
+
+                       try:
+                               oldvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline()
+                               open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0")
+                       except:
+                               print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
+
+                       frontend = eDVBResourceManager.getInstance().allocateRawChannel(fe_id).getFrontend()
+                       frontend.closeFrontend()
+                       open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value)
+                       frontend.reopenFrontend()
+                       try:
+                               open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(oldvalue)
+                       except:
+                               print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
+                       nimmgr.enumerateNIMs()
+               else:
+                       print "tuner type is already already %d" %cur_type
+
        empty_slots = 0
        for slot in nimmgr.nim_slots:
                x = slot.slot