from Tools.HardwareInfo import HardwareInfo
+from Tools.BoundFunction import boundFunction
from config import config, ConfigSubsection, ConfigSelection, ConfigFloat, \
ConfigSatlist, ConfigYesNo, ConfigInteger, ConfigSubList, ConfigNothing, \
from time import localtime, mktime
from datetime import datetime
+from Tools.BoundFunction import boundFunction
def getConfigSatlist(orbpos, satlist):
default_orbpos = None
def getNimDescription(self, slotid):
return self.nim_slots[slotid].friendly_full_description
+
+ def getNimName(self, slotid):
+ return self.nim_slots[slotid].description
def getNimListOfType(self, type, exception = -1):
# returns a list of indexes for NIMs compatible to the given type, except for 'exception'
# the configElement should be only visible when diseqc 1.2 is disabled
def InitNimManager(nimmgr):
- InitSecParams()
hw = HardwareInfo()
+ addNimConfig = False
+ try:
+ config.Nims
+ except:
+ addNimConfig = True
- config.Nims = ConfigSubList()
- for x in range(len(nimmgr.nim_slots)):
- config.Nims.append(ConfigSubsection())
+ if addNimConfig:
+ InitSecParams()
+ config.Nims = ConfigSubList()
+ for x in range(len(nimmgr.nim_slots)):
+ config.Nims.append(ConfigSubsection())
lnb_choices = {
"universal_lnb": _("Universal LNB"),
section.latitude = ConfigFloat(default = [50,767], limits = [(0,359),(0,999)])
section.latitudeOrientation = ConfigSelection(latitude_orientation_choices, "north")
section.powerMeasurement = ConfigYesNo(default=True)
- section.powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100))
+ section.powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm7025" and 50 or 15, limits=(0, 100))
section.turningSpeed = ConfigSelection(turning_speed_choices, "fast")
section.fastTurningBegin = ConfigDateTime(default=advanced_lnb_fast_turning_btime, formatstring = _("%H:%M"), increment = 600)
section.fastTurningEnd = ConfigDateTime(default=advanced_lnb_fast_turning_etime, formatstring = _("%H:%M"), increment = 600)
if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2':
open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value)
- def tunerTypeChanged(configElement):
+ def tunerTypeChanged(nimmgr, configElement):
fe_id = configElement.fe_id
+ print "tunerTypeChanged feid %d to mode %s" % (fe_id, 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()
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:
x = slot.slot
nim = config.Nims[x]
- if slot.isMultiType():
+ addMultiType = False
+ try:
+ nim.multiType
+ except:
+ addMultiType = True
+ if slot.isMultiType() and addMultiType:
typeList = []
- value = None
for id in slot.getMultiTypeList().keys():
type = slot.getMultiTypeList()[id]
typeList.append((id, type))
- if type == slot.getType():
- value = id
nim.multiType = ConfigSelection(typeList, "0")
- nim.multiType.value = value
+
nim.multiType.fe_id = x - empty_slots
- nim.multiType.addNotifier(tunerTypeChanged)
+ 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"):
nim.toneAmplitude = ConfigSelection([("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7")
nim.toneAmplitude.fe_id = x - empty_slots