+
+ def tunerTypeChanged(nimmgr, configElement):
+ fe_id = configElement.fe_id
+ eDVBResourceManager.getInstance().setFrontendType(nimmgr.nim_slots[fe_id].frontend_id, nimmgr.nim_slots[fe_id].getType())
+ import os
+ if os.path.exists("/proc/stb/frontend/%d/mode" % fe_id):
+ cur_type = int(open("/proc/stb/frontend/%d/mode" % (fe_id), "r").read())
+ if cur_type == int(configElement.value):
+ print "tuner type is already already %d" %cur_type
+ return
+ print "tunerTypeChanged feid %d from %d to mode %d" % (fe_id, cur_type, int(configElement.value))
+
+ print "tunerTypeChanged feid %d, mode %d" % (fe_id, 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()
+
+ if os.path.exists("/proc/stb/frontend/%d/mode" % fe_id):
+ 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()
+
+ empty_slots = 0
+ for slot in nimmgr.nim_slots:
+ print "[InitNimManager] check multi type slot %d" % slot.slot
+ x = slot.slot
+ nim = config.Nims[x]
+ addMultiType = False
+ try:
+ nim.multiType
+ except:
+ addMultiType = True
+ if slot.isMultiType() and addMultiType:
+ print "[InitNimManager] slot %d is multi type : " % slot.slot, slot.getMultiTypeList()
+ typeList = []
+ for id in slot.getMultiTypeList().keys():
+ type = slot.getMultiTypeList()[id]
+ typeList.append((id, type))
+ nim.multiType = ConfigSelection(typeList, "0")
+ nim.multiType.fe_id = x - empty_slots
+ nim.multiType.addNotifier(boundFunction(tunerTypeChanged, nimmgr))
+
+ empty_slots = 0
+ for slot in nimmgr.nim_slots:
+ x = slot.slot
+ nim = config.Nims[x]
+
+ if slot.isCompatible("DVB-S"):
+ createSatConfig(nim, x, empty_slots)
+ config_mode_choices = [ ("nothing", _("nothing connected")),
+ ("simple", _("simple")), ("advanced", _("advanced"))]
+ if len(nimmgr.getNimListOfType(slot.getType(), exception = x)) > 0:
+ config_mode_choices.append(("equal", _("equal to")))
+ config_mode_choices.append(("satposdepends", _("second cable of motorized LNB")))
+ if len(nimmgr.canConnectTo(x)) > 0:
+ config_mode_choices.append(("loopthrough", _("loopthrough to")))
+ nim.advanced = ConfigNothing()
+ tmp = ConfigSelection(config_mode_choices, "nothing")
+ tmp.slot_id = x
+ tmp.addNotifier(configModeChanged, initial_call = False)
+ nim.configMode = tmp
+ elif slot.isCompatible("DVB-C"):
+ nim.configMode = ConfigSelection(
+ choices = {
+ "enabled": _("enabled"),
+ "nothing": _("nothing connected"),
+ },
+ default = "enabled")
+ createCableConfig(nim, x)
+ elif slot.isCompatible("DVB-T"):
+ nim.configMode = ConfigSelection(
+ choices = {
+ "enabled": _("enabled"),
+ "nothing": _("nothing connected"),
+ },
+ default = "enabled")
+ createTerrestrialConfig(nim, x)