Skip to content

Apple silicon #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 12, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix cpu and friendly model for apple silicon
  • Loading branch information
grahamgilbert committed Nov 2, 2021
commit c3333edc771c1d101fe89e855a628fec7b439274
24 changes: 21 additions & 3 deletions payload/usr/local/sal/checkin_modules/machine_checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ def process_system_profile():
friendly_model = get_friendly_model(machine_results["serial"])
if friendly_model:
machine_results["machine_model_friendly"] = friendly_model
machine_results["cpu_type"] = system_profile["SPHardwareDataType"][0].get(
"cpu_type", ""
)
if system_profile["SPHardwareDataType"][0].get("chip_type", None):
machine_results["cpu_type"] = system_profile["SPHardwareDataType"][0].get(
"chip_type", ""
)
else:
machine_results["cpu_type"] = system_profile["SPHardwareDataType"][0].get(
"cpu_type", ""
)
machine_results["cpu_speed"] = system_profile["SPHardwareDataType"][0][
"current_processor_speed"
]
Expand Down Expand Up @@ -100,6 +105,19 @@ def get_machine_name(net_config, nametype):

def get_friendly_model(serial):
"""Return friendly model name"""
cmd = ["/usr/sbin/ioreg", "-arc", "IOPlatformDevice", "-k", "product-name"]
try:
out = subprocess.check_output(cmd)
except:
pass
if out:
try:
data = plistlib.loads(out)
if len(data) != 0:
return data[0].get("product-name").decode("utf-8")
except:
pass

if not MODEL_PATH.exists():
model = cleanup_model(query_apple_support(serial))
if model:
Expand Down