-
Notifications
You must be signed in to change notification settings - Fork 10
/
board_id.py
executable file
·34 lines (27 loc) · 1.31 KB
/
board_id.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
# ref: https://gist.github.com/bruienne/f81ea88253629abaf5f9
import objc
import plistlib
class attrdict(dict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
ServerInformation = attrdict()
ServerInformation_bundle = objc.loadBundle('ServerInformation', ServerInformation, \
bundle_path='/System/Library/PrivateFrameworks/ServerInformation.framework')
platformsupport = plistlib.readPlist('/System/Library/CoreServices/PlatformSupport.plist')
#
disabledsystems = platformsupport.get('SupportedBoardIds')
#
print('------------------------------------------------------------\n%i Board IDs in list\n------------------------------------------------------------\n' % len(disabledsystems))
unmatchedboardids = []
for system in disabledsystems:
for modelid in ServerInformation.ServerInformationComputerModelInfo.modelPropertiesForBoardIDs_([system]):
if system not in modelid:
print('Board ID: %s = System ID: %s' % (system, modelid))
else:
unmatchedboardids.append(system)
if len(unmatchedboardids) > 0:
print('------------------------------------------------------------')
for boardid in unmatchedboardids:
print('-- No match for Board ID %s --' % boardid)
print('------------------------------------------------------------\n')