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