Skip to content

Commit

Permalink
Solved possible GSODs when switching between simple and advanced
Browse files Browse the repository at this point in the history
E.g. when you press blue button in SatConfig which means restore to what
it wass you could or better will get a GSOD when the changes were from
advanced back to simple. By simply always define advanced this is
solved. It also simplifies again some code in NimManager.py
  • Loading branch information
littlesat committed Feb 22, 2019
1 parent 0075405 commit c598a15
Showing 1 changed file with 39 additions and 47 deletions.
86 changes: 39 additions & 47 deletions lib/python/Components/NimManager.py
Expand Up @@ -1350,41 +1350,6 @@ def configLNBChanged(configElement):
tmp.addNotifier(configLOFChanged, initial_call = False)
section.lof = tmp

def configModeChanged(configMode):
slot_id = configMode.slot_id
nim = config.Nims[slot_id]
if configMode.value == "advanced" and isinstance(nim.advanced, ConfigNothing):
# advanced config:
nim.advanced = ConfigSubsection()
nim.advanced.sat = ConfigSubDict()
nim.advanced.sats = getConfigSatlist(192, advanced_satlist_choices)
nim.advanced.lnb = ConfigSubDict()
nim.advanced.lnb[0] = ConfigNothing()
for x in nimmgr.satList:
tmp = ConfigSubsection()
tmp.voltage = ConfigSelection(advanced_voltage_choices, "polarization")
tmp.tonemode = ConfigSelection(advanced_tonemode_choices, "band")
tmp.usals = ConfigYesNo(True)
tmp.rotorposition = ConfigInteger(default=1, limits=(1, 255))
lnb = ConfigSelection(advanced_lnb_choices, "0")
lnb.slot_id = slot_id
lnb.addNotifier(configLNBChanged, initial_call = False)
tmp.lnb = lnb
nim.advanced.sat[x[0]] = tmp
for x in range(3601, 3607):
tmp = ConfigSubsection()
tmp.voltage = ConfigSelection(advanced_voltage_choices, "polarization")
tmp.tonemode = ConfigSelection(advanced_tonemode_choices, "band")
tmp.usals = ConfigYesNo(default=True)
tmp.userSatellitesList = ConfigText('[]')
tmp.rotorposition = ConfigInteger(default=1, limits=(1, 255))
lnbnum = 65+x-3601
lnb = ConfigSelection([("0", _("not configured")), (str(lnbnum), "LNB %d"%(lnbnum))], "0")
lnb.slot_id = slot_id
lnb.addNotifier(configLNBChanged, initial_call = False)
tmp.lnb = lnb
nim.advanced.sat[x] = tmp

def scpcSearchRangeChanged(configElement):
fe_id = configElement.fe_id
slot_id = configElement.slot_id
Expand All @@ -1402,21 +1367,21 @@ def t2miRawModeChanged(configElement):
if os.path.exists("/proc/stb/frontend/%d/t2mirawmode" % slot):
open("/proc/stb/frontend/%d/t2mirawmode" % slot, "w").write(configElement.value)

def createSatConfig(nim, x, empty_slots):
def createSatConfig(nim, slot_id, empty_slots):
nim.toneAmplitude = ConfigSelection([("11", "340mV"), ("10", "360mV"), ("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7")
nim.toneAmplitude.fe_id = x - empty_slots
nim.toneAmplitude.slot_id = x
nim.toneAmplitude.fe_id = slot_id - empty_slots
nim.toneAmplitude.slot_id = slot_id
nim.toneAmplitude.addNotifier(toneAmplitudeChanged)
nim.scpcSearchRange = ConfigSelection([("0", _("no")), ("1", _("yes"))], "0")
nim.scpcSearchRange.fe_id = x - empty_slots
nim.scpcSearchRange.slot_id = x
nim.scpcSearchRange.fe_id = slot_id - empty_slots
nim.scpcSearchRange.slot_id = slot_id
nim.scpcSearchRange.addNotifier(scpcSearchRangeChanged)
nim.t2miRawMode = ConfigSelection([("disable", _("disabled")), ("enable", _("enabled"))], "disable")
nim.t2miRawMode.slot = x
nim.t2miRawMode.slot = slot_id
nim.t2miRawMode.addNotifier(t2miRawModeChanged)
nim.diseqc13V = ConfigYesNo(False)
nim.diseqcMode = ConfigSelection(diseqc_mode_choices, "diseqc_a_b")
nim.connectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x])
nim.connectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != slot_id])
nim.simpleSingleSendDiSEqC = ConfigYesNo(False)
nim.simpleDiSEqCSetVoltageTone = ConfigYesNo(True)
nim.simpleDiSEqCOnlyOnSatChange = ConfigYesNo(False)
Expand Down Expand Up @@ -1444,6 +1409,36 @@ def createSatConfig(nim, x, empty_slots):
etime = datetime(1970, 1, 1, 19, 0)
nim.fastTurningEnd = ConfigDateTime(default = mktime(etime.timetuple()), formatstring = _("%H:%M"), increment = 900)

nim.advanced = ConfigSubsection()
nim.advanced.sat = ConfigSubDict()
nim.advanced.sats = getConfigSatlist(192, advanced_satlist_choices)
nim.advanced.lnb = ConfigSubDict()
nim.advanced.lnb[0] = ConfigNothing()
for x in nimmgr.satList:
tmp = ConfigSubsection()
tmp.voltage = ConfigSelection(advanced_voltage_choices, "polarization")
tmp.tonemode = ConfigSelection(advanced_tonemode_choices, "band")
tmp.usals = ConfigYesNo(True)
tmp.rotorposition = ConfigInteger(default=1, limits=(1, 255))
lnb = ConfigSelection(advanced_lnb_choices, "0")
lnb.slot_id = slot_id
lnb.addNotifier(configLNBChanged, initial_call = False)
tmp.lnb = lnb
nim.advanced.sat[x[0]] = tmp
for x in range(3601, 3607):
tmp = ConfigSubsection()
tmp.voltage = ConfigSelection(advanced_voltage_choices, "polarization")
tmp.tonemode = ConfigSelection(advanced_tonemode_choices, "band")
tmp.usals = ConfigYesNo(default=True)
tmp.userSatellitesList = ConfigText('[]')
tmp.rotorposition = ConfigInteger(default=1, limits=(1, 255))
lnbnum = 65+x-3601
lnb = ConfigSelection([("0", _("not configured")), (str(lnbnum), "LNB %d"%(lnbnum))], "0")
lnb.slot_id = slot_id
lnb.addNotifier(configLNBChanged, initial_call = False)
tmp.lnb = lnb
nim.advanced.sat[x] = tmp

def createCableConfig(nim, x):
list = [(x[0], x[0]) for x in nimmgr.cablesList]
nim.cable = ConfigSubsection()
Expand Down Expand Up @@ -1565,11 +1560,8 @@ def tunerConfigChanged(nim, configElement=None):
config_mode_choices["satposdepends"] = _("Second cable of motorized LNB")
if len(nimmgr.canConnectTo(x)) > 0:
config_mode_choices["loopthrough"] = _("Loop through from")
nim.advanced = ConfigNothing()
tmp = ConfigSelection(config_mode_choices, slot.isFBCLink() and "nothing" or "simple")
tmp.slot_id = x
tmp.addNotifier(configModeChanged, initial_call = False)
nim.configMode = tmp
nim.configMode = ConfigSelection(config_mode_choices, slot.isFBCLink() and "nothing" or "simple")
nim.configMode.slot_id = x
elif slot.canBeCompatible("DVB-C") or slot.canBeCompatible("DVB-T") or slot.canBeCompatible("ATSC"):
nim.configMode = ConfigSelection(choices = {"enabled": _("enabled"), "nothing": _("disabled")}, default = "enabled")
else:
Expand Down

0 comments on commit c598a15

Please sign in to comment.