<widget name="menu" position="10,10" size="440,310" />
</screen>
<!-- Nim selection -->
- <screen name="NimSelection" position="center,center" size="400,330" title="Choose Tuner">
- <widget source="nimlist" render="Listbox" position="0,0" size="380,360" scrollbarMode="showOnDemand">
+ <screen name="NimSelection" position="center,center" size="490,330" title="Choose Tuner">
+ <widget source="nimlist" render="Listbox" position="0,0" size="460,360" scrollbarMode="showOnDemand">
<convert type="TemplatedMultiContent">
{"template": [
- MultiContentEntryText(pos = (10, 5), size = (360, 30), flags = RT_HALIGN_LEFT, text = 1), # index 1 is the nim name,
- MultiContentEntryText(pos = (50, 30), size = (320, 50), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings,
+ MultiContentEntryText(pos = (10, 5), size = (440, 30), flags = RT_HALIGN_LEFT, text = 1), # index 1 is the nim name,
+ MultiContentEntryText(pos = (50, 30), size = (400, 50), font = 1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is a description of the nim settings,
],
"fonts": [gFont("Regular", 20), gFont("Regular", 15)],
"itemHeight": 80
</code>
</step>
<step id="parentalsetup">
- <text value="You need to set a pin code and hide it from your children.\n\nDo you want to set the pin now?" />
+ <text value="You need to set a PIN code and hide it from your children.\n\nDo you want to set the pin now?" />
<list>
<listentry caption="Yes" step="finishparentalsetup" />
- <listentry caption="No" step="finishparentalsetup" />
+ <listentry caption="No" step="warnpin" />
</list>
<code pos="after">
from ParentalControlSetup import ParentalControlChangePin
self.session.open(ParentalControlChangePin, config.ParentalControl.servicepin[0], _("parental control pin"))
</code>
</step>
+ <step id="warnpin">
+ <text value="Please be aware, that anyone can disable the parental control, if you have not set a PIN." />
+ </step>
<step id="finishparentalsetup">
<code>
-config.ParentalControl.setuppinactive.value = True
+if config.ParentalControl.setuppin.value == "aaaa":
+ config.ParentalControl.setuppinactive.value = False
+else:
+ config.ParentalControl.setuppinactive.value = True
config.ParentalControl.setuppinactive.save()
config.ParentalControl.servicepinactive.value = True
config.ParentalControl.servicepinactive.save()
PyErr_SetString(PyExc_StandardError, "eDVBResourceManager::setFrontendSlotInformations argument should be a python list");
return NULL;
}
- if ((unsigned int)PyList_Size(list) != m_frontend.size())
+ unsigned int assigned=0;
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
{
+ int pos=0;
+ while (pos < PyList_Size(list)) {
+ ePyObject obj = PyList_GET_ITEM(list, pos++);
+ if (!i->m_frontend->setSlotInfo(obj))
+ continue;
+ ++assigned;
+ break;
+ }
+ }
+ if (assigned != m_frontend.size()) {
char blasel[256];
- sprintf(blasel, "eDVBResourceManager::setFrontendSlotInformations list size incorrect %d frontends avail, but %d entries in slotlist",
- m_frontend.size(), PyList_Size(list));
+ sprintf(blasel, "eDVBResourceManager::setFrontendSlotInformations .. assigned %d socket informations, but %d registered frontends!",
+ m_frontend.size(), assigned);
PyErr_SetString(PyExc_StandardError, blasel);
return NULL;
}
- int pos=0;
- for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
- {
- ePyObject obj = PyList_GET_ITEM(list, pos++);
- if (!i->m_frontend->setSlotInfo(obj))
- return NULL;
- }
- pos=0;
for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_simulate_frontend.begin()); i != m_simulate_frontend.end(); ++i)
{
- ePyObject obj = PyList_GET_ITEM(list, pos++);
- if (!i->m_frontend->setSlotInfo(obj))
- return NULL;
+ int pos=0;
+ while (pos < PyList_Size(list)) {
+ ePyObject obj = PyList_GET_ITEM(list, pos++);
+ if (!i->m_frontend->setSlotInfo(obj))
+ continue;
+ break;
+ }
}
Py_RETURN_NONE;
}
bool eDVBFrontend::setSlotInfo(ePyObject obj)
{
- ePyObject Id, Descr, Enabled, IsDVBS2;
- if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 4)
+ ePyObject Id, Descr, Enabled, IsDVBS2, frontendId;
+ if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 5)
goto arg_error;
Id = PyTuple_GET_ITEM(obj, 0);
Descr = PyTuple_GET_ITEM(obj, 1);
Enabled = PyTuple_GET_ITEM(obj, 2);
IsDVBS2 = PyTuple_GET_ITEM(obj, 3);
- if (!PyInt_Check(Id) || !PyString_Check(Descr) || !PyBool_Check(Enabled) || !PyBool_Check(IsDVBS2))
+ frontendId = PyTuple_GET_ITEM(obj, 4);
+ m_slotid = PyInt_AsLong(Id);
+ if (!PyInt_Check(Id) || !PyString_Check(Descr) || !PyBool_Check(Enabled) || !PyBool_Check(IsDVBS2) || !PyInt_Check(frontendId))
goto arg_error;
strcpy(m_description, PyString_AS_STRING(Descr));
- m_slotid = PyInt_AsLong(Id);
+ if (PyInt_AsLong(frontendId) == -1 || PyInt_AsLong(frontendId) != m_dvbid) {
+// eDebugNoSimulate("skip slotinfo for slotid %d, descr %s",
+// m_slotid, m_description);
+ return false;
+ }
m_enabled = Enabled == Py_True;
// HACK.. the rotor workaround is neede for all NIMs with LNBP21 voltage regulator...
m_need_rotor_workaround = !!strstr(m_description, "Alps BSBE1") ||
//reset some tuner configuration
for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
{
- long tmp;
- char c;
- if (sscanf(it->m_frontend->getDescription(), "BCM450%c (internal)", &c) == 1 && !it->m_frontend->getData(eDVBFrontend::LINKED_PREV_PTR, tmp) && tmp != -1)
- {
- FILE *f=fopen("/proc/stb/tsmux/lnb_b_input", "w");
- if (!f || fwrite("B", 1, 1, f) != 1)
- eDebug("set /proc/stb/tsmux/lnb_b_input to B failed!! (%m)");
- else
- {
- eDebug("set /proc/stb/tsmux/lnb_b_input to B OK");
- fclose(f);
- }
- }
it->m_frontend->setData(eDVBFrontend::SATPOS_DEPENDS_PTR, -1);
it->m_frontend->setData(eDVBFrontend::LINKED_PREV_PTR, -1);
it->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, -1);
char c;
p1->m_frontend->setData(eDVBFrontend::LINKED_PREV_PTR, (long)p2);
p2->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, (long)p1);
- if (!strcmp(p1->m_frontend->getDescription(), p2->m_frontend->getDescription()) && sscanf(p1->m_frontend->getDescription(), "BCM450%c (internal)", &c) == 1)
- {
- FILE *f=fopen("/proc/stb/tsmux/lnb_b_input", "w");
- if (!f || fwrite("A", 1, 1, f) != 1)
- eDebug("set /proc/stb/tsmux/lnb_b_input to A failed!! (%m)");
- else
- {
- eDebug("set /proc/stb/tsmux/lnb_b_input to A OK");
- fclose(f);
- }
- }
}
p1=p2=NULL;
def setSatposDepends(self, sec, nim1, nim2):
print "tuner", nim1, "depends on satpos of", nim2
sec.setTunerDepends(nim1, nim2)
+
+ def linkInternally(self, slotid):
+ nim = self.NimManager.getNim(slotid)
+ if nim.internallyConnectableTo is not None:
+ nim.setInternalLink()
def linkNIMs(self, sec, nim1, nim2):
print "link tuner", nim1, "to tuner", nim2
+ if nim2 == (nim1 - 1):
+ self.linkInternally(nim1)
sec.setTunerLinked(nim1, nim2)
def getRoot(self, slotid, connto):
def update(self):
sec = secClass.getInstance()
self.configuredSatellites = set()
+ for slotid in self.NimManager.getNimListOfType("DVB-S"):
+ if self.NimManager.nimInternallyConnectableTo(slotid) is not None:
+ self.NimManager.nimRemoveInternalLink(slotid)
sec.clear() ## this do unlinking NIMs too !!
print "sec config cleared"
for slot in nim_slots:
if slot.type is not None:
- used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2")))
+ used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2"), slot.frontend_id is None and -1 or slot.frontend_id))
eDVBResourceManager.getInstance().setFrontendSlotInformations(used_nim_slots)
for slot in nim_slots:
self.update()
class NIM(object):
- def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}):
+ def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}, frontend_id = None, i2c = None, is_empty = False):
self.slot = slot
if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None):
self.has_outputs = has_outputs
self.internally_connectable = internally_connectable
self.multi_type = multi_type
+ self.i2c = i2c
+ self.frontend_id = frontend_id
+ self.__is_empty = is_empty
def isCompatible(self, what):
+ if not self.isSupported():
+ return False
compatible = {
None: (None,),
"DVB-S": ("DVB-S", None),
def getSlotID(self):
return chr(ord('A') + self.slot)
+ def getI2C(self):
+ return self.i2c
+
def hasOutputs(self):
return self.has_outputs
def internallyConnectableTo(self):
return self.internally_connectable
+ def setInternalLink(self):
+ if self.internally_connectable is not None:
+ print "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
+ open("/proc/stb/frontend/%d/rf_switch" % self.frontend_id, "w").write("external")
+
def isMultiType(self):
return (len(self.multi_type) > 0)
+ def isEmpty(self):
+ return self.__is_empty
+
+ # empty tuners are supported!
+ def isSupported(self):
+ return (self.frontend_id is not None) or self.__is_empty
+
# returns dict {<slotid>: <type>}
def getMultiTypeList(self):
return self.multi_type
if self.empty:
nim_text += _("(empty)")
+ elif not self.isSupported():
+ nim_text += self.description + " (" + _("not supported") + ")"
else:
- nim_text += self.description + " (" + self.friendly_type + ")"
+ nim_text += self.description + " (" + self.friendly_type + ")"
return nim_text
entries[current_slot] = {}
elif line.strip().startswith("Type:"):
entries[current_slot]["type"] = str(line.strip()[6:])
+ entries[current_slot]["isempty"] = False
elif line.strip().startswith("Name:"):
entries[current_slot]["name"] = str(line.strip()[6:])
+ entries[current_slot]["isempty"] = False
elif line.strip().startswith("Has_Outputs:"):
input = str(line.strip()[len("Has_Outputs:") + 1:])
entries[current_slot]["has_outputs"] = (input == "yes")
elif line.strip().startswith("Internally_Connectable:"):
input = int(line.strip()[len("Internally_Connectable:") + 1:])
entries[current_slot]["internally_connectable"] = input
+ elif line.strip().startswith("Frontend_Device:"):
+ input = int(line.strip()[len("Frontend_Device:") + 1:])
+ entries[current_slot]["frontend_device"] = input
elif line.strip().startswith("Mode"):
# "Mode 0: DVB-T" -> ["Mode 0", " DVB-T"]
split = line.strip().split(":")
modes = entries[current_slot].get("multi_type", {})
modes[split2[1]] = split[1].strip()
entries[current_slot]["multi_type"] = modes
+ elif line.strip().startswith("I2C_Device:"):
+ input = int(line.strip()[len("I2C_Device:") + 1:])
+ entries[current_slot]["i2c"] = input
elif line.strip().startswith("empty"):
entries[current_slot]["type"] = None
entries[current_slot]["name"] = _("N/A")
+ entries[current_slot]["isempty"] = True
nimfile.close()
+ from os import path
+
for id, entry in entries.items():
if not (entry.has_key("name") and entry.has_key("type")):
entry["name"] = _("N/A")
entry["type"] = None
+ if not (entry.has_key("i2c")):
+ entry["i2c"] = None
if not (entry.has_key("has_outputs")):
entry["has_outputs"] = True
- if not (entry.has_key("internally_connectable")):
- entry["internally_connectable"] = None
+ if entry.has_key("frontend_device"): # check if internally connectable
+ if path.exists("/proc/stb/frontend/%d/rf_switch" % entry["frontend_device"]):
+ entry["internally_connectable"] = entry["frontend_device"] - 1
+ else:
+ entry["internally_connectable"] = None
+ else:
+ entry["frontend_device"] = entry["internally_connectable"] = None
if not (entry.has_key("multi_type")):
entry["multi_type"] = {}
- self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"]))
+ self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"], frontend_id = entry["frontend_device"], i2c = entry["i2c"], is_empty = entry["isempty"]))
def hasNimType(self, chktype):
for slot in self.nim_slots:
def getNimName(self, slotid):
return self.nim_slots[slotid].description
+
+ def getNim(self, slotid):
+ return self.nim_slots[slotid]
+
+ def getI2CDevice(self, slotid):
+ return self.nim_slots[slotid].getI2C()
def getNimListOfType(self, type, exception = -1):
# returns a list of indexes for NIMs compatible to the given type, except for 'exception'
def hasOutputs(self, slotid):
return self.nim_slots[slotid].hasOutputs()
+ def nimInternallyConnectableTo(self, slotid):
+ return self.nim_slots[slotid].internallyConnectableTo()
+
+ def nimRemoveInternalLink(self, slotid):
+ self.nim_slots[slotid].removeInternalLink()
+
def canConnectTo(self, slotid):
slots = []
if self.nim_slots[slotid].internallyConnectableTo() is not None:
self.relevantAudioPIDs = [ ]
self.getRelevantAudioPIDs(title)
self.generated_files = [ ]
+ self.mplex_audiofiles = { }
+ self.mplex_videofile = ""
self.mplex_streamfiles = [ ]
if len(self.cutlist) > 1:
self.args += [ "-cut", self.cutfile ]
def haveNewFile(self, file):
print "[DemuxTask] produced file:", file, self.currentPID
self.generated_files.append(file)
- if self.currentPID in self.relevantAudioPIDs or file.endswith("m2v"):
- self.mplex_streamfiles.append(file)
+ if self.currentPID in self.relevantAudioPIDs:
+ self.mplex_audiofiles[self.currentPID] = file
+ elif file.endswith("m2v"):
+ self.mplex_videofile = file
def haveProgress(self, progress):
#print "PROGRESS [%s]" % progress
f.close()
def cleanup(self, failed):
+ print "[DemuxTask::cleanup]"
+ self.mplex_streamfiles = [ self.mplex_videofile ]
+ for pid in self.relevantAudioPIDs:
+ self.mplex_streamfiles.append(self.mplex_audiofiles[pid])
+ print self.mplex_streamfiles
+
if failed:
import os
for file in self.generated_files:
pid = str(i.getPID())
if description == "MPEG":
description = "MP2"
- print "[audiotrack] pid:", pid, "description:", description, "language:", DVB_lang
+ print "[audiotrack] pid:", pid, "description:", description, "language:", DVB_lang, "count:", x, "active:", (x < 8)
self.t.properties.audiotracks.append(ConfigSubsection())
- self.t.properties.audiotracks[-1].active = ConfigYesNo(default = True)
+ self.t.properties.audiotracks[-1].active = ConfigYesNo(default = (x < 8))
self.t.properties.audiotracks[-1].format = ConfigFixedText(description)
self.t.properties.audiotracks[-1].language = ConfigSelection(choices = languageChoices.choices, default=languageChoices.getLanguage(DVB_lang))
self.t.properties.audiotracks[-1].pid = ConfigFixedText(pid)
#self.list.append(getConfigListEntry(_("Configuration mode"), config.ParentalControl.mode))
self.list.append(getConfigListEntry(_("Protect setup"), config.ParentalControl.setuppinactive))
if config.ParentalControl.setuppinactive.value:
- self.changeSetupPin = getConfigListEntry(_("Change setup pin"), NoSave(ConfigNothing()))
+ self.changeSetupPin = getConfigListEntry(_("Change setup PIN"), NoSave(ConfigNothing()))
self.list.append(self.changeSetupPin)
self.list.append(getConfigListEntry(_("Protect services"), config.ParentalControl.servicepinactive))
if config.ParentalControl.servicepinactive.value:
self.list.append(getConfigListEntry(_("Parental control type"), config.ParentalControl.type))
if config.ParentalControl.mode.value == "complex":
- self.changePin = getConfigListEntry(_("Change service pins"), NoSave(ConfigNothing()))
+ self.changePin = getConfigListEntry(_("Change service PINs"), NoSave(ConfigNothing()))
self.list.append(self.changePin)
elif config.ParentalControl.mode.value == "simple":
- self.changePin = getConfigListEntry(_("Change service pin"), NoSave(ConfigNothing()))
+ self.changePin = getConfigListEntry(_("Change service PIN"), NoSave(ConfigNothing()))
self.list.append(self.changePin)
#Added Option to remember the service pin
- self.list.append(getConfigListEntry(_("Remember service pin"), config.ParentalControl.storeservicepin))
+ self.list.append(getConfigListEntry(_("Remember service PIN"), config.ParentalControl.storeservicepin))
#Added Option to remember the cancellation of service pin entry
- self.list.append(getConfigListEntry(_("Remember service pin cancel"), config.ParentalControl.storeservicepincancel))
+ self.list.append(getConfigListEntry(_("Remember service PIN cancel"), config.ParentalControl.storeservicepincancel))
self.editListEntry = getConfigListEntry(_("Edit services list"), NoSave(ConfigNothing()))
self.list.append(self.editListEntry)
#New funtion: Possibility to add Bouquets to whitelist / blacklist
if config.ParentalControl.mode.value == "complex":
pass
else:
- self.session.open(ParentalControlChangePin, config.ParentalControl.servicepin[0], _("service pin"))
+ self.session.open(ParentalControlChangePin, config.ParentalControl.servicepin[0], _("service PIN"))
elif self["config"].l.getCurrentSelection() == self.changeSetupPin:
- self.session.open(ParentalControlChangePin, config.ParentalControl.setuppin, _("setup pin"))
+ self.session.open(ParentalControlChangePin, config.ParentalControl.setuppin, _("setup PIN"))
elif self["config"].l.getCurrentSelection() == self.reloadLists:
parentalControl.open()
else:
def SetupPinMessageCallback(self, value):
if value:
- self.session.openWithCallback(self.cancelCB, ParentalControlChangePin, config.ParentalControl.setuppin, _("setup pin"))
+ self.session.openWithCallback(self.cancelCB, ParentalControlChangePin, config.ParentalControl.setuppin, _("setup PIN"))
else:
config.ParentalControl.setuppinactive.value = False
self.keyCancel()
def ServicePinMessageCallback(self, value):
if value:
- self.session.openWithCallback(self.cancelCB, ParentalControlChangePin, config.ParentalControl.servicepin[0], _("service pin"))
+ self.session.openWithCallback(self.cancelCB, ParentalControlChangePin, config.ParentalControl.servicepin[0], _("service PIN"))
else:
config.ParentalControl.servicepinactive.value = False
self.keyCancel()
self.pin2 = ConfigPIN(default = 1112, censor = "*")
self.pin1.addEndNotifier(boundFunction(self.valueChanged, 1))
self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2))
- self.list.append(getConfigListEntry(_("New pin"), NoSave(self.pin1)))
- self.list.append(getConfigListEntry(_("Reenter new pin"), NoSave(self.pin2)))
+ self.list.append(getConfigListEntry(_("New PIN"), NoSave(self.pin1)))
+ self.list.append(getConfigListEntry(_("Reenter new PIN"), NoSave(self.pin2)))
ConfigListScreen.__init__(self, self.list)
# print "old pin:", pin
#if pin.value != "aaaa":
self.keyOK()
def getPinText(self):
- return _("Please enter the old pin code")
+ return _("Please enter the old PIN code")
def isProtected(self):
return (self.pin.value != "aaaa")
if self.pin1.value == self.pin2.value:
self.pin.value = self.pin1.value
self.pin.save()
- self.session.openWithCallback(self.close, MessageBox, _("The pin code has been changed successfully."), MessageBox.TYPE_INFO)
+ self.session.openWithCallback(self.close, MessageBox, _("The PIN code has been changed successfully."), MessageBox.TYPE_INFO)
else:
- self.session.open(MessageBox, _("The pin codes you entered are different."), MessageBox.TYPE_ERROR)
+ self.session.open(MessageBox, _("The PIN codes you entered are different."), MessageBox.TYPE_ERROR)
def cancel(self):
self.close(None)
def okbuttonClick(self):
nim = self["nimlist"].getCurrent()
nim = nim and nim[3]
- if nim is not None and not nim.empty:
+ if nim is not None and not nim.empty and nim.isSupported():
self.session.openWithCallback(self.updateList, self.resultclass, nim.slot)
def showNim(self, nim):
text = _("enabled")
if x.isMultiType():
text = _("Switchable tuner types:") + "(" + ','.join(x.getMultiTypeList().values()) + ")" + "\n" + text
+ if not x.isSupported():
+ text = _("tuner is not supported")
self.list.append((slotid, x.friendly_full_description, text, x))
self["nimlist"].setList(self.list)
self.cable_search_container.dataAvail.append(self.getCableTransponderData)
cableConfig = config.Nims[nim_idx].cable
tunername = nimmanager.getNimName(nim_idx)
+ bus = nimmanager.getI2CDevice(nim_idx)
+ if bus is None:
+ print "ERROR: could not get I2C device for nim", nim_idx, "for cable transponder search"
+ bus = 2
+
if tunername == "CXD1981":
- cmd = "cxd1978 --init --scan --verbose --wakeup --inv 2 --bus "
- else:
- cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus "
- #FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000
- if nim_idx < 2:
- if HardwareInfo().get_device_name() == "dm500hd":
- cmd += "2"
- else:
- cmd += str(nim_idx)
+ cmd = "cxd1978 --init --scan --verbose --wakeup --inv 2 --bus %d" % bus
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
+ cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus %d" % bus
+
if cableConfig.scan_type.value == "bands":
cmd += " --scan-bands "
bands = 0