add box detection as fallback when /proc/stb/info is not avail (old drivers
[enigma2.git] / lib / python / Tools / HardwareInfo.py
1 class HardwareInfo:
2         def __init__(self):
3                 self.device = "unknown"
4                 try:
5                         file = open("/proc/stb/info/model", "r")
6                         self.device = file.readline().strip()
7                         file.close()
8                 except:
9                         print "----------------"
10                         print "you should upgrade to new drivers for the hardware detection to work properly"
11                         print "----------------"
12                         print "fallback to detect hardware via /proc/cpuinfo!!"
13                         try:
14                                 rd = open("/proc/cpuinfo", "r").read()
15                                 if rd.find("Brcm4380 V4.2") != 0:
16                                         self.device = "dm8000"
17                                         print "dm8000 detected!"
18                                 elif rd.find("Brcm7401 V0.0") != 0:
19                                         self.device = "dm800"
20                                         print "dm800 detected!"
21                                 elif rd.find("MIPS 4KEc V4.8") != 0:
22                                         self.device = "dm7025"
23                                         print "dm7025 detected!"
24                         except:
25                                 pass
26
27         def get_device_name(self):
28                 return self.device
29         
30         device_name = property(get_device_name)
31