diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2009-06-09 02:34:47 +0200 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2009-06-09 02:34:47 +0200 |
| commit | bdd9e446243db1603e5ab6018ecbed3d4c8a59bd (patch) | |
| tree | 08b4600b578c573ce04e8b20e44daeb00b01d8df /lib/python/Tools/HardwareInfo.py | |
| parent | 1d8153e23d1cd08c83a784a5b3a00cb4b6ee33f1 (diff) | |
| download | enigma2-bdd9e446243db1603e5ab6018ecbed3d4c8a59bd.tar.gz enigma2-bdd9e446243db1603e5ab6018ecbed3d4c8a59bd.zip | |
statially store detected hardware type; it's unlikely to change at runtime
Diffstat (limited to 'lib/python/Tools/HardwareInfo.py')
| -rw-r--r-- | lib/python/Tools/HardwareInfo.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/python/Tools/HardwareInfo.py b/lib/python/Tools/HardwareInfo.py index 9fb17dac..612a565f 100644 --- a/lib/python/Tools/HardwareInfo.py +++ b/lib/python/Tools/HardwareInfo.py @@ -1,9 +1,15 @@ class HardwareInfo: + device_name = None + def __init__(self): - self.device = "unknown" + if HardwareInfo.device_name is not None: + print "using cached result" + return + + HardwareInfo.device_name = "unknown" try: file = open("/proc/stb/info/model", "r") - self.device = file.readline().strip() + HardwareInfo.device_name = file.readline().strip() file.close() except: print "----------------" @@ -13,19 +19,16 @@ class HardwareInfo: try: rd = open("/proc/cpuinfo", "r").read() if rd.find("Brcm4380 V4.2") != -1: - self.device = "dm8000" + HardwareInfo.device_name = "dm8000" print "dm8000 detected!" elif rd.find("Brcm7401 V0.0") != -1: - self.device = "dm800" + HardwareInfo.device_name = "dm800" print "dm800 detected!" elif rd.find("MIPS 4KEc V4.8") != -1: - self.device = "dm7025" + HardwareInfo.device_name = "dm7025" print "dm7025 detected!" except: pass def get_device_name(self): - return self.device - - device_name = property(get_device_name) - + return HardwareInfo.device_name |
