NimManager: Add class name in print messages to aid when debugging
authorAthanasios Oikonomou <athoik@gmail.com>
Thu, 17 Dec 2015 18:48:21 +0000 (20:48 +0200)
committerErik Slagter <erik@openpli.org>
Fri, 18 Dec 2015 09:38:12 +0000 (10:38 +0100)
(cherry picked from commit 799eb48477e00a46d57aebf83ef236b75282809e)
Signed-off-by: Erik Slagter <erik@openpli.org>

lib/python/Components/NimManager.py

index 816c946..2b06905 100644 (file)
@@ -96,7 +96,7 @@ class SecConfigure:
                                                if ("," not in orbpos and sat_str == orbpos) or ((', ' + sat_str + ',' in orbpos) or (orbpos.startswith(sat_str + ',')) or (orbpos.endswith(', ' + sat_str))):
                                                        user_satList.append(user_sat)
                        for x in user_satList:
-                               print "Add sat " + str(x[0])
+                               print "[SecConfigure] Add sat " + str(x[0])
                                self.addSatellite(sec, int(x[0]))
                                if diseqc13V:
                                        sec.setVoltageMode(switchParam.HV_13)
@@ -108,7 +108,7 @@ class SecConfigure:
                sec.setLNBSlotMask(tunermask)
 
        def setSatposDepends(self, sec, nim1, nim2):
-               print "tuner", nim1, "depends on satpos of", nim2
+               print "[SecConfigure] tuner", nim1, "depends on satpos of", nim2
                sec.setTunerDepends(nim1, nim2)
 
        def linkInternally(self, slotid):
@@ -117,7 +117,7 @@ class SecConfigure:
                        nim.setInternalLink()
 
        def linkNIMs(self, sec, nim1, nim2):
-               print "link tuner", nim1, "to tuner", nim2
+               print "[SecConfigure] link tuner", nim1, "to tuner", nim2
                if nim2 == (nim1 - 1):
                        self.linkInternally(nim1)
                sec.setTunerLinked(nim1, nim2)
@@ -138,7 +138,7 @@ class SecConfigure:
                        if self.NimManager.nimInternallyConnectableTo(slotid) is not None:
                                self.NimManager.nimRemoveInternalLink(slotid)
                sec.clear() ## this do unlinking NIMs too !!
-               print "sec config cleared"
+               print "[SecConfigure] sec config cleared"
 
                self.linked = { }
                self.satposdepends = { }
@@ -196,7 +196,7 @@ class SecConfigure:
                        nim = slot.config
                        hw = HardwareInfo()
                        if slot.isCompatible("DVB-S"):
-                               print "slot: " + str(x) + " configmode: " + str(nim.configMode.value)
+                               print "[SecConfigure] slot: " + str(x) + " configmode: " + str(nim.configMode.value)
                                if nim.configMode.value in ( "loopthrough", "satposdepends", "nothing" ):
                                        pass
                                else:
@@ -204,7 +204,7 @@ class SecConfigure:
                                        if nim.configMode.value == "equal":
                                                pass
                                        elif nim.configMode.value == "simple":          #simple config
-                                               print "diseqcmode: ", nim.diseqcMode.value
+                                               print "[SecConfigure] diseqcmode: ", nim.diseqcMode.value
                                                if nim.diseqcMode.value == "single":                    #single
                                                        currentCircular = False
                                                        if nim.diseqcA.value in ("360", "560"): 
@@ -267,7 +267,7 @@ class SecConfigure:
                                                                diseqc13V = nim.diseqc13V.value)
                                        elif nim.configMode.value == "advanced": #advanced config
                                                self.updateAdvanced(sec, x)
-               print "sec config completed"
+               print "[SecConfigure] sec config completed"
 
        def updateAdvanced(self, sec, slotid):
                try:
@@ -293,7 +293,7 @@ class SecConfigure:
                        lnb = int(config.Nims[slotid].advanced.sat[x].lnb.value)
                        if lnb != 0:
                                for x in self.NimManager.satList:
-                                       print "add", x[0], "to", lnb
+                                       print "[SecConfigure] add", x[0], "to", lnb
                                        lnbSat[lnb].append(x[0])
 
                #wildcard for user satellites ( for rotor )
@@ -305,13 +305,13 @@ class SecConfigure:
                                for user_sat in self.NimManager.satList:
                                        sat_str = str(user_sat[0])
                                        if userSatlist and ("," not in userSatlist and sat_str == userSatlist) or ((', ' + sat_str + ',' in userSatlist) or (userSatlist.startswith(sat_str + ',')) or (userSatlist.endswith(', ' + sat_str))):
-                                               print "add", user_sat[0], "to", lnb
+                                               print "[SecConfigure] add", user_sat[0], "to", lnb
                                                lnbSat[lnb].append(user_sat[0])
 
                for x in self.NimManager.satList:
                        lnb = int(config.Nims[slotid].advanced.sat[x[0]].lnb.value)
                        if lnb != 0:
-                               print "add", x[0], "to", lnb
+                               print "[SecConfigure] add", x[0], "to", lnb
                                lnbSat[lnb].append(x[0])
 
                for x in range(1, 71):
@@ -519,7 +519,7 @@ class NIM(object):
                self.slot = slot
 
                if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", "DVB-T2", "DVB-C2", "ATSC", None):
-                       print "warning: unknown NIM type %s, not using." % type
+                       print "[NIM] warning: unknown NIM type %s, not using." % type
                        type = None
 
                self.type = type
@@ -599,12 +599,12 @@ class NIM(object):
 
        def setInternalLink(self):
                if self.internally_connectable is not None:
-                       print "setting internal link on frontend id", self.frontend_id
+                       print "[NIM] 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
+                       print "[NIM] 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):
@@ -704,14 +704,14 @@ class NimManager:
                db = eDVBDB.getInstance()
 
                if self.hasNimType("DVB-S"):
-                       print "Reading satellites.xml"
+                       print "[NimManager] Reading satellites.xml"
                        db.readSatellites(self.satList, self.satellites, self.transponders)
                        self.satList.sort() # sort by orbpos
 
                if self.hasNimType("DVB-C") or self.hasNimType("DVB-T"):
-                       print "Reading cables.xml"
+                       print "[NimManager] Reading cables.xml"
                        db.readCables(self.cablesList, self.transponderscable)
-                       print "Reading terrestrial.xml"
+                       print "[NimManager] Reading terrestrial.xml"
                        db.readTerrestrials(self.terrestrialsList, self.transpondersterrestrial)
 
        def enumerateNIMs(self):
@@ -1327,13 +1327,13 @@ def InitNimManager(nimmgr):
                                                sectionDict[y] = tmp
 
                                if lnb < 3:
-                                       print "MATRIX"
+                                       print "[InitNimManager] MATRIX"
                                        section.unicableMatrix = ConfigSubDict()
                                        section.unicableMatrixManufacturer = ConfigSelection(UnicableMatrixManufacturers, UnicableMatrixManufacturers[0])
                                        fillUnicableConf(section.unicableMatrix, unicablematrixproducts, True)
 
                                if lnb < 2:
-                                       print "LNB"
+                                       print "[InitNimManager] LNB"
                                        section.unicableLnb = ConfigSubDict()
                                        section.unicableLnbManufacturer = ConfigSelection(UnicableLnbManufacturers, UnicableLnbManufacturers[0])
                                        fillUnicableConf(section.unicableLnb, unicablelnbproducts, False)
@@ -1580,7 +1580,7 @@ def InitNimManager(nimmgr):
                        empty_slots += 1
                        nim.configMode = ConfigSelection(choices = { "nothing": _("disabled") }, default="nothing");
                        if slot.type is not None:
-                               print "pls add support for this frontend type!", slot.type
+                               print "[InitNimManager] pls add support for this frontend type!", slot.type
 
        nimmgr.sec = SecConfigure(nimmgr)
 
@@ -1596,7 +1596,7 @@ def InitNimManager(nimmgr):
                                        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"
+                                       print "[InitNimManager] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
 
                                frontend = eDVBResourceManager.getInstance().allocateRawChannel(fe_id).getFrontend()
                                frontend.closeFrontend()
@@ -1605,10 +1605,10 @@ def InitNimManager(nimmgr):
                                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"
+                                       print "[InitNimManager] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
                                nimmgr.enumerateNIMs()
                        else:
-                               print "tuner type is already already %d" %cur_type
+                               print "[InitNimManager] tuner type is already already %d" %cur_type
                except:
                        pass