use frontend type infomation in /proc/nim_sockets to detect if a frontend
[enigma2.git] / lib / python / Components / NimManager.py
index ea234c1143f5ea81eb5f05645dff478f36244efa..bf718fd038d96274feeb4fa030f4a647f23acdb8 100644 (file)
@@ -84,8 +84,8 @@ class SecConfigure:
                        for x in self.NimManager.satList:
                                print "Add sat " + str(x[0])
                                self.addSatellite(sec, int(x[0]))
-                               sec.setVoltageMode(0)
-                               sec.setToneMode(0)
+                               sec.setVoltageMode(switchParam.HV)
+                               sec.setToneMode(switchParam.HILO)
                                sec.setRotorPosNum(0) # USALS
                
                sec.setLNBSlotMask(tunermask)
@@ -123,7 +123,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))
+                               used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2")))
                eDVBResourceManager.getInstance().setFrontendSlotInformations(used_nim_slots)
 
                for slot in nim_slots:
@@ -155,7 +155,6 @@ class SecConfigure:
                        nim = slot.config
                        if slot.isCompatible("DVB-S"):
                                print "slot: " + str(x) + " configmode: " + str(nim.configMode.value)
-                               print "diseqcmode: ", nim.diseqcMode.value
                                if nim.configMode.value in [ "loopthrough", "satposdepends", "nothing" ]:
                                        pass
                                else:
@@ -163,6 +162,7 @@ class SecConfigure:
                                        if nim.configMode.value == "equal":
                                                pass
                                        elif nim.configMode.value == "simple":          #simple config
+                                               print "diseqcmode: ", nim.diseqcMode.value
                                                if nim.diseqcMode.value == "single":                    #single
                                                        self.addLNBSimple(sec, slotid = x, orbpos = nim.diseqcA.orbital_position, toneburstmode = diseqcParam.NO, diseqcmode = diseqcParam.NONE, diseqcpos = diseqcParam.SENDNO)
                                                elif nim.diseqcMode.value == "toneburst_a_b":           #Toneburst A/B
@@ -276,8 +276,9 @@ class SecConfigure:
                                elif dm == "1_2":
                                        sec.setDiSEqCMode(diseqcParam.V1_2)
 
-                                       if self.satposdepends.has_key(slotid):  # only useable with rotors
-                                               tunermask |= (1 << self.satposdepends[slotid])
+                               if self.satposdepends.has_key(slotid):
+                                       for slot in self.satposdepends[slotid]:
+                                               tunermask |= (1 << slot)
 
                                if dm != "none":
                                        if currLnb.toneburst.value == "none":
@@ -371,12 +372,12 @@ class SecConfigure:
                                                sec.setVoltageMode(switchParam._14V)
                                        elif currSat.voltage.value == "18V":
                                                sec.setVoltageMode(switchParam._18V)
-                                               
-                                       if currSat.tonemode == "band":
+
+                                       if currSat.tonemode.value == "band":
                                                sec.setToneMode(switchParam.HILO)
-                                       elif currSat.tonemode == "on":
+                                       elif currSat.tonemode.value == "on":
                                                sec.setToneMode(switchParam.ON)
-                                       elif currSat.tonemode == "off":
+                                       elif currSat.tonemode.value == "off":
                                                sec.setToneMode(switchParam.OFF)
                                                
                                        if not currSat.usals.value and x < 34:
@@ -724,9 +725,14 @@ class NimManager:
                                        for x in self.satList:
                                                list.append(x)
                        elif configMode == "advanced":
-                               for x in self.satList:
-                                       if int(nim.advanced.sat[x[0]].lnb.value) != 0:
-                                               list.append(x)
+                               for x in range(3601, 3605):
+                                       if int(nim.advanced.sat[x].lnb.value) != 0:
+                                               for x in self.satList:
+                                                       list.append(x)
+                               if not list:
+                                       for x in self.satList:
+                                               if int(nim.advanced.sat[x[0]].lnb.value) != 0:
+                                                       list.append(x)
                return list
 
        def getRotorSatListForNim(self, slotid):
@@ -741,13 +747,18 @@ class NimManager:
                                        for x in self.satList:
                                                list.append(x)
                        elif configMode == "advanced":
-                               for x in self.satList:
-                                       nim = config.Nims[slotid]
-                                       lnbnum = int(nim.advanced.sat[x[0]].lnb.value)
-                                       if lnbnum != 0:
-                                               lnb = nim.advanced.lnb[lnbnum]
-                                               if lnb.diseqcMode.value == "1_2":
+                               nim = config.Nims[slotid]
+                               for x in range(3601, 3605):
+                                       if int(nim.advanced.sat[x].lnb.value) != 0:
+                                               for x in self.satList:
                                                        list.append(x)
+                               if not list:
+                                       for x in self.satList:
+                                               lnbnum = int(nim.advanced.sat[x[0]].lnb.value)
+                                               if lnbnum != 0:
+                                                       lnb = nim.advanced.lnb[lnbnum]
+                                                       if lnb.diseqcMode.value == "1_2":
+                                                               list.append(x)
                return list
 
 def InitSecParams():
@@ -837,15 +848,6 @@ def InitNimManager(nimmgr):
                                choices["loopthrough"] = _("loopthrough to")
                        nim.configMode = ConfigSelection(choices = choices, default = "nothing")
 
-                       #important - check if just the 2nd one is LT only and the first one is DVB-S
-                       # CHECKME: is this logic correct for >2 slots?
-#                      if nim.configMode.value in ["loopthrough", "satposdepends", "equal"]:
-#                              if x == 0: # first one can never be linked to anything
-#                                      # reset to simple
-#                                      nim.configMode.value = "simple"
-#                                      nim.configMode.save()
-#                              else:
-                                       #FIXME: make it better
                        for y in nimmgr.nim_slots:
                                if y.slot == 0:
                                        if not y.isCompatible("DVB-S"):
@@ -890,7 +892,7 @@ def InitNimManager(nimmgr):
 
                        # advanced config:
                        nim.advanced = ConfigSubsection()
-                       tmp = [(3601, _('All Satellites 1'), 1), (3602, _('All Satellites 2'), 1), (3603, _('All Satellites 3'), 1), (3604, _('All Satellites 4'), 1)]
+                       tmp = [(3601, _('All Satellites')+' 1', 1), (3602, _('All Satellites')+' 2', 1), (3603, _('All Satellites')+' 3', 1), (3604, _('All Satellites')+' 4', 1)]
                        nim.advanced.sats = getConfigSatlist(192,nimmgr.satList+tmp)
                        nim.advanced.sat = ConfigSubDict()
                        lnbs = [("0", "not available")]