+cable_bands = {
+ "DVBC_BAND_EU_VHF_I" : 1 << 0,
+ "DVBC_BAND_EU_MID" : 1 << 1,
+ "DVBC_BAND_EU_VHF_III" : 1 << 2,
+ "DVBC_BAND_EU_SUPER" : 1 << 3,
+ "DVBC_BAND_EU_HYPER" : 1 << 4,
+ "DVBC_BAND_EU_UHF_IV" : 1 << 5,
+ "DVBC_BAND_EU_UHF_V" : 1 << 6,
+ "DVBC_BAND_US_LO" : 1 << 7,
+ "DVBC_BAND_US_MID" : 1 << 8,
+ "DVBC_BAND_US_HI" : 1 << 9,
+ "DVBC_BAND_US_SUPER" : 1 << 10,
+ "DVBC_BAND_US_HYPER" : 1 << 11,
+}
+
+class CableTransponderSearchSupport:
+# def setCableTransponderSearchResult(self, tlist):
+# pass
+
+# def cableTransponderSearchFinished(self):
+# pass
+
+ def tryGetRawFrontend(self, feid):
+ res_mgr = eDVBResourceManager.getInstance()
+ if res_mgr:
+ raw_channel = res_mgr.allocateRawChannel(self.feid)
+ if raw_channel:
+ frontend = raw_channel.getFrontend()
+ if frontend:
+ del frontend
+ del raw_channel
+ return True
+ return False
+
+ def cableTransponderSearchSessionClosed(self, *val):
+ print "cableTransponderSearchSessionClosed, val", val
+ self.cable_search_container.appClosed.remove(self.cableTransponderSearchClosed)
+ self.cable_search_container.dataAvail.remove(self.getCableTransponderData)
+ self.cable_search_container = None
+ self.cable_search_session = None
+ if val and len(val) and val[0]:
+ self.setCableTransponderSearchResult(self.__tlist)
+ self.__tlist = None
+ self.cableTransponderSearchFinished()
+
+ def cableTransponderSearchClosed(self, retval):
+ print "cableTransponderSearch finished", retval
+ self.cable_search_session.close(True)
+
+ def getCableTransponderData(self, str):
+ data = str.split()
+ if len(data):
+ if data[0] == 'OK':
+ print str
+ parm = eDVBFrontendParametersCable()
+ qam = { "QAM16" : parm.Modulation_QAM16,
+ "QAM32" : parm.Modulation_QAM32,
+ "QAM64" : parm.Modulation_QAM64,
+ "QAM128" : parm.Modulation_QAM128,
+ "QAM256" : parm.Modulation_QAM256 }
+ inv = { "INVERSION_OFF" : parm.Inversion_Off,
+ "INVERSION_ON" : parm.Inversion_On,
+ "INVERSION_AUTO" : parm.Inversion_Unknown }
+ fec = { "FEC_AUTO" : parm.FEC_Auto,
+ "FEC_1_2" : parm.FEC_1_2,
+ "FEC_2_3" : parm.FEC_2_3,
+ "FEC_3_4" : parm.FEC_3_4,
+ "FEC_5_6": parm.FEC_5_6,
+ "FEC_7_8" : parm.FEC_7_8,
+ "FEC_8_9" : parm.FEC_8_9,
+ "FEC_NONE" : parm.FEC_None }
+ parm.frequency = int(data[1])
+ parm.symbol_rate = int(data[2])
+ parm.fec_inner = fec[data[3]]
+ parm.modulation = qam[data[4]]
+ parm.inversion = inv[data[5]]
+ self.__tlist.append(parm)
+ tmpstr = _("Try to find used Transponders in cable network.. please wait...")
+ tmpstr += "\n\n"
+ tmpstr += data[1]
+ tmpstr += " kHz "
+ tmpstr += data[0]
+ self.cable_search_session["text"].setText(tmpstr)
+
+ def startCableTransponderSearch(self, nim_idx):
+ if not self.tryGetRawFrontend(nim_idx):
+ self.session.nav.stopService()
+ if not self.tryGetRawFrontend(nim_idx):
+ if self.session.pipshown: # try to disable pip
+ self.session.pipshown = False
+ del self.session.pip
+ if not self.tryGetRawFrontend(nim_idx):
+ self.cableTransponderSearchFinished()
+ return
+ self.__tlist = [ ]
+ self.cable_search_container = eConsoleAppContainer()
+ self.cable_search_container.appClosed.append(self.cableTransponderSearchClosed)
+ self.cable_search_container.dataAvail.append(self.getCableTransponderData)
+ cableConfig = config.Nims[nim_idx].cable
+ cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus "
+ #FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000
+ if nim_idx < 2:
+ cmd += str(nim_idx)
+ else:
+ if nim_idx == 2:
+ cmd += "2" # first nim socket on DM8000 use /dev/i2c/2
+ else:
+ cmd += "4" # second nim socket on DM8000 use /dev/i2c/4
+ if cableConfig.scan_type.value == "bands":
+ cmd += " --scan-bands "
+ bands = 0
+ if cableConfig.scan_band_EU_VHF_I.value:
+ bands |= cable_bands["DVBC_BAND_EU_VHF_I"]
+ if cableConfig.scan_band_EU_MID.value:
+ bands |= cable_bands["DVBC_BAND_EU_MID"]
+ if cableConfig.scan_band_EU_VHF_III.value:
+ bands |= cable_bands["DVBC_BAND_EU_VHF_III"]
+ if cableConfig.scan_band_EU_UHF_IV.value:
+ bands |= cable_bands["DVBC_BAND_EU_UHF_IV"]
+ if cableConfig.scan_band_EU_UHF_V.value:
+ bands |= cable_bands["DVBC_BAND_EU_UHF_V"]
+ if cableConfig.scan_band_EU_SUPER.value:
+ bands |= cable_bands["DVBC_BAND_EU_SUPER"]
+ if cableConfig.scan_band_EU_HYPER.value:
+ bands |= cable_bands["DVBC_BAND_EU_HYPER"]
+ if cableConfig.scan_band_US_LOW.value:
+ bands |= cable_bands["DVBC_BAND_US_LO"]
+ if cableConfig.scan_band_US_MID.value:
+ bands |= cable_bands["DVBC_BAND_US_MID"]
+ if cableConfig.scan_band_US_HIGH.value:
+ bands |= cable_bands["DVBC_BAND_US_HI"]
+ if cableConfig.scan_band_US_SUPER.value:
+ bands |= cable_bands["DVBC_BAND_US_SUPER"]
+ if cableConfig.scan_band_US_HYPER.value:
+ bands |= cable_bands["DVBC_BAND_US_HYPER"]
+ cmd += str(bands)
+ else:
+ cmd += " --scan-stepsize "
+ cmd += str(cableConfig.scan_frequency_steps.value)
+ if cableConfig.scan_mod_qam16.value:
+ cmd += " --mod 16"
+ if cableConfig.scan_mod_qam32.value:
+ cmd += " --mod 32"
+ if cableConfig.scan_mod_qam64.value:
+ cmd += " --mod 64"
+ if cableConfig.scan_mod_qam128.value:
+ cmd += " --mod 128"
+ if cableConfig.scan_mod_qam256.value:
+ cmd += " --mod 256"
+ if cableConfig.scan_sr_6900.value:
+ cmd += " --sr 6900000"
+ if cableConfig.scan_sr_6875.value:
+ cmd += " --sr 6875000"
+ if cableConfig.scan_sr_ext1.value > 450:
+ cmd += " --sr "
+ cmd += str(cableConfig.scan_sr_ext1.value)
+ cmd += "000"
+ if cableConfig.scan_sr_ext2.value > 450:
+ cmd += " --sr "
+ cmd += str(cableConfig.scan_sr_ext2.value)
+ cmd += "000"
+ print "TDA1002x CMD is", cmd
+
+ self.cable_search_container.execute(cmd)
+ tmpstr = _("Try to find used transponders in cable network.. please wait...")
+ tmpstr += "\n\n..."
+ self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO)
+
+class DefaultSatLists(DefaultWizard):
+ def __init__(self, session, silent = True, showSteps = False):
+ self.xmlfile = "defaultsatlists.xml"
+ DefaultWizard.__init__(self, session, silent, showSteps, neededTag = "services")
+ print "configuredSats:", nimmanager.getConfiguredSats()
+
+ def setDirectory(self):
+ self.directory = []
+ self.directory.append(resolveFilename(SCOPE_DEFAULTDIR))
+ import os
+ os.system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)))
+ self.directory.append(resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR))
+
+ def statusCallback(self, status, progress):
+ print "statusCallback:", status, progress
+ from Components.DreamInfoHandler import DreamInfoHandler
+ if status == DreamInfoHandler.STATUS_DONE:
+ self["text"].setText(_("The installation of the default services lists is finished.") + "\n\n" + _("Please press OK to continue."))
+ self.markDone()
+ self.disableKeys = False
+
+class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):