refs bug #587
[enigma2.git] / lib / python / Components / NimManager.py
index cb832e41a87f48797d547d039e64367fdb957b8f..4d562b9563d068a1a354dc6ed29b96843dace583 100644 (file)
@@ -110,9 +110,16 @@ class SecConfigure:
        def setSatposDepends(self, sec, nim1, nim2):
                print "tuner", nim1, "depends on satpos of", nim2
                sec.setTunerDepends(nim1, nim2)
        def setSatposDepends(self, sec, nim1, nim2):
                print "tuner", nim1, "depends on satpos of", nim2
                sec.setTunerDepends(nim1, nim2)
+               
+       def linkInternally(self, slotid):
+               nim = self.NimManager.getNim(slotid)
+               if nim.internallyConnectableTo is not None:
+                       nim.setInternalLink()
 
        def linkNIMs(self, sec, nim1, nim2):
                print "link tuner", nim1, "to tuner", nim2
 
        def linkNIMs(self, sec, nim1, nim2):
                print "link tuner", nim1, "to tuner", nim2
+               if nim2 == (nim1 - 1):
+                       self.linkInternally(nim1)
                sec.setTunerLinked(nim1, nim2)
                
        def getRoot(self, slotid, connto):
                sec.setTunerLinked(nim1, nim2)
                
        def getRoot(self, slotid, connto):
@@ -127,6 +134,9 @@ class SecConfigure:
        def update(self):
                sec = secClass.getInstance()
                self.configuredSatellites = set()
        def update(self):
                sec = secClass.getInstance()
                self.configuredSatellites = set()
+               for slotid in self.NimManager.getNimListOfType("DVB-S"):
+                       if self.NimManager.nimInternallyConnectableTo(slotid) is not None:
+                               self.NimManager.nimRemoveInternalLink(slotid)
                sec.clear() ## this do unlinking NIMs too !!
                print "sec config cleared"
 
                sec.clear() ## this do unlinking NIMs too !!
                print "sec config cleared"
 
@@ -526,6 +536,16 @@ class NIM(object):
        def internallyConnectableTo(self):
                return self.internally_connectable
        
        def internallyConnectableTo(self):
                return self.internally_connectable
        
+       def setInternalLink(self):
+               if self.internally_connectable is not None:
+                       print "setting internal link on frontend id", self.frontend_id
+                       open("/proc/stb/frontend/%d/rf_switch" % self.frontend_id, "w").write("internal")
+               
+       def removeInternalLink(self):
+               if self.internally_connectable is not None:
+                       print "removing internal link on frontend id", self.frontend_id
+                       open("/proc/stb/frontend/%d/rf_switch" % self.frontend_id, "w").write("external")
+       
        def isMultiType(self):
                return (len(self.multi_type) > 0)
        
        def isMultiType(self):
                return (len(self.multi_type) > 0)
        
@@ -735,6 +755,9 @@ class NimManager:
        
        def getNimName(self, slotid):
                return self.nim_slots[slotid].description
        
        def getNimName(self, slotid):
                return self.nim_slots[slotid].description
+       
+       def getNim(self, slotid):
+               return self.nim_slots[slotid]
 
        def getNimListOfType(self, type, exception = -1):
                # returns a list of indexes for NIMs compatible to the given type, except for 'exception'
 
        def getNimListOfType(self, type, exception = -1):
                # returns a list of indexes for NIMs compatible to the given type, except for 'exception'
@@ -765,6 +788,12 @@ class NimManager:
        def hasOutputs(self, slotid):
                return self.nim_slots[slotid].hasOutputs()
        
        def hasOutputs(self, slotid):
                return self.nim_slots[slotid].hasOutputs()
        
+       def nimInternallyConnectableTo(self, slotid):
+               return self.nim_slots[slotid].internallyConnectableTo()
+       
+       def nimRemoveInternalLink(self, slotid):
+               self.nim_slots[slotid].removeInternalLink()
+       
        def canConnectTo(self, slotid):
                slots = []
                if self.nim_slots[slotid].internallyConnectableTo() is not None:
        def canConnectTo(self, slotid):
                slots = []
                if self.nim_slots[slotid].internallyConnectableTo() is not None: