From: Ronny Strutz Date: Fri, 11 Nov 2005 15:13:49 +0000 (+0000) Subject: get plugged NIMs from /proc X-Git-Tag: 2.6.0~5328 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/38ff0ca06ff4cdf7ff7d94211f4be533c53dcc83?hp=a87fa9b66303029df036c71bbe5aba241fc0790f get plugged NIMs from /proc --- diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 8bbe2810..f04d076d 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -18,6 +18,13 @@ from Tools import XMLTools from xml.sax import make_parser from xml.sax.handler import ContentHandler +def tryOpen(filename): + try: + procFile = open(filename) + except IOError: + return "" + return procFile + class SecConfigure: def addLNBSimple(self, slotid, orbpos, toneburstmode, diseqcmode, diseqcpos): #simple defaults @@ -122,6 +129,30 @@ class NimManager: def getNimType(self, slotID): #FIXME get it from /proc + nimfile = tryOpen("/proc/bus/nim_sockets") + + if nimfile == "": + return self.nimType["empty/unknown"] + + while 1: + line = nimfile.readline() + if line == "": + break + if line.startswith("NIM Socket"): + parts = line.strip().split(" ") + id = int(parts[2][:1]) + if id == slotID: + line = nimfile.readline() + if line == "": + break + if line.startswith(" Type:"): + nimfile.close() + return self.nimType["DVB-S"] + else: + break + nimfile.close() + return self.nimType["empty/unknown"] + if slotID == 0: return self.nimType["DVB-S"] elif slotID == 1: