Merge branch 'bug_387_small_spinner_fix' into experimental
[enigma2.git] / lib / python / Tools / HardwareInfo.py
index f426d180aef4a7495474e1aa53abc7d55181585a..e72d29124d6b3389769ece725c1c0627c5306a79 100644 (file)
@@ -1,17 +1,34 @@
 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 "----------------"
                        print "you should upgrade to new drivers for the hardware detection to work properly"
                        print "----------------"
-               
-       def get_device_name(self):
-               return self.device
-       
-       device_name = property(get_device_name)
+                       print "fallback to detect hardware via /proc/cpuinfo!!"
+                       try:
+                               rd = open("/proc/cpuinfo", "r").read()
+                               if rd.find("Brcm4380 V4.2") != -1:
+                                       HardwareInfo.device_name = "dm8000"
+                                       print "dm8000 detected!"
+                               elif rd.find("Brcm7401 V0.0") != -1:
+                                       HardwareInfo.device_name = "dm800"
+                                       print "dm800 detected!"
+                               elif rd.find("MIPS 4KEc V4.8") != -1:
+                                       HardwareInfo.device_name = "dm7025"
+                                       print "dm7025 detected!"
+                       except:
+                               pass
 
+       def get_device_name(self):
+               return HardwareInfo.device_name