From 0ffddc5916909206895777778b1ac99073ae1ca2 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 6 Oct 2010 08:58:34 +0200 Subject: refs bug #593 get i2c device from /proc/bus/nim_sockets for automatic scans --- lib/python/Components/NimManager.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/python/Components') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 805be4df..2a1cbad3 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -471,7 +471,7 @@ class SecConfigure: 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 = {}, i2c = None): self.slot = slot if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None): @@ -483,6 +483,7 @@ class NIM(object): self.has_outputs = has_outputs self.internally_connectable = internally_connectable self.multi_type = multi_type + self.i2c = i2c def isCompatible(self, what): compatible = { @@ -517,6 +518,9 @@ class NIM(object): def getSlotID(self): return chr(ord('A') + self.slot) + def getI2C(self): + return self.i2c + def hasOutputs(self): return self.has_outputs @@ -683,6 +687,9 @@ class NimManager: 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") @@ -692,13 +699,15 @@ class NimManager: 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 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"], i2c = entry["i2c"])) def hasNimType(self, chktype): for slot in self.nim_slots: -- cgit v1.2.3 From fe72b7929c2f0b5dbac3040b303d195923735fc8 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 6 Oct 2010 09:43:35 +0200 Subject: fixes bug #593 use i2c_device from /proc/bus/nim_sockets for automatic cable scan --- lib/python/Components/NimManager.py | 3 +++ lib/python/Screens/ScanSetup.py | 21 ++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'lib/python/Components') diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index f934ed50..67a1abc8 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -769,6 +769,9 @@ class NimManager: 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' diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index f4828088..2e2f8364 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -192,21 +192,16 @@ class CableTransponderSearchSupport: 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 -- cgit v1.2.3