Skip to content

Commit

Permalink
Merge pull request #5 from myDevicesIoT/fix/hardware-info
Browse files Browse the repository at this point in the history
Update manufacturer and model detection.
  • Loading branch information
jburhenn authored Jul 31, 2017
2 parents 8a91f06 + 84a9b5b commit 8a7b310
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions myDevices/os/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,43 @@ def __init__(self):
if key=='Revision':
self.Revision = value
except:
exception ("Error reading cpuinfo")
self.model = {}
self.model["Beta"] = "Model B (Beta)"
self.model["000d"] = self.model["000e"] = self.model["000f"] = self.model["0002"] = self.model["0003"] = self.model["0004"] = self.model["0005"] = self.model["0006"] = "Model B"
self.model["0007"] = self.model["0008"] = self.model["0009"] = "Model A"
self.model["0010"] = "Model B+"
self.model["0011"] = "Compute Module"
self.model["0012"] = "Model A+"
self.model["0013"] = "Model B+"
self.model["a01041"] = "Pi 2 Model B"
self.model["a21041"] = "Pi 2 Model B"
self.model["900092"] = "Zero"
self.model["a22082"]=self.model["a02082"] = "Pi 3 Model B"
exception ("Error reading cpuinfo")
self.model = 'Unknown'
if self.Revision == 'Beta':
self.model = 'Model B (Beta)'
if self.Revision in ('000d', '000e', '000f', '0002', '0003', '0004', '0005', '0006'):
self.model = 'Model B'
if self.Revision in ('0007', '0008', '0009'):
self.model = 'Model A'
if self.Revision in ('0010', '0013', '900032'):
self.model = 'Model B +'
if self.Revision in ('0011', '0014'):
self.model = 'Compute Module'
if self.Revision in ('0012', '0015'):
self.model = 'Model A+'
if self.Revision in ('a01041', 'a21041', 'a22042'):
self.model = 'Pi 2 Model B'
if self.Revision in ('900092', '900093'):
self.model = 'Zero'
if self.Revision in ('9000c1',):
self.model = 'Zero W'
if self.Revision in ('a02082', 'a22082'):
self.model = 'Pi 3 Model B'
self.manufacturer = 'Element14/Premier Farnell'
if self.Revision in ('a01041', '900092', 'a02082', '0012', '0011', '0010', '000e', '0008', '0004'):
self.manufacturer = 'Sony, UK'
if self.Revision in ('0014', '0015', 'a21041', 'a22082'):
self.manufacturer = 'Embest, China'
if self.Revision in ('0005', '0009', '000f'):
self.manufacturer = 'Qisda'
if self.Revision in ('0006', '0007', '000d'):
self.manufacturer = 'Egoman'

def getManufacturer(self):
if self.Revision in ["a01041","900092", "a02082", "0012", "0011", "0010", "000e", "0008", "0004"]:
return "Sony, UK"
if self.Revision == "a21041":
return "Embest, China"
if self.Revision in ["0005", "0009", "000f"]:
return "Qisda"
if self.Revision in ["0006", "0007", "000d"]:
return "Egoman"
return "Element14/Premier Farnell"
return self.manufacturer

def getModel(self):
try:
model = self.model[self.Revision]
except:
model = "Unknown"
return model
return self.model

def getMac(self, format=2):
if format < 2:
Expand Down

0 comments on commit 8a7b310

Please sign in to comment.