<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
//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"
self.update()
class NIM(object):
- def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}, i2c = None):
+ def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}, frontend_id = None, i2c = None):
+
self.slot = slot
if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None):
self.internally_connectable = internally_connectable
self.multi_type = multi_type
self.i2c = i2c
+ self.frontend_id = frontend_id
def isCompatible(self, what):
+ if not self.isSupported():
+ return False
compatible = {
None: (None,),
"DVB-S": ("DVB-S", None),
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 isSupported(self):
+ return (self.frontend_id is not None)
+
# 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
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(":")
entries[current_slot]["name"] = _("N/A")
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["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"], i2c = entry["i2c"]))
+ 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"]))
+
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 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: