From 1831096456b7a1ab91cceb6140403dffea1d22cf Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Tue, 17 Mar 2026 21:02:06 +0100 Subject: [PATCH] firmware: Handle devices without ALS Devices without internal display like Mac mini, Studio and Pro do not have an ambient light sensor. The ioreg subprocess will not produce any output but return with exit status 0. Handle this gracefully. This might hide unexpected cases on devices with ALS but a simple solution without listing devices. Fixes: 766ecc0 ("Extract and store ALS calibration") Signed-off-by: Janne Grunau --- asahi_firmware/als.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/asahi_firmware/als.py b/asahi_firmware/als.py index 189a84c..c21d73b 100644 --- a/asahi_firmware/als.py +++ b/asahi_firmware/als.py @@ -16,6 +16,9 @@ def load(self): if ioreg.returncode != 0: log.warning("Unable to run ioreg, ambient light sensor calibration will not be saved") return + if len(ioreg.stdout) == 0: + log.info("ioreg without 'als' object. Possibly a device without ambient light sensor.") + return tree = plistlib.loads(ioreg.stdout) try: cal_data = tree[0]["IORegistryEntryChildren"][0]["IORegistryEntryChildren"][0]["IORegistryEntryChildren"][0]["CalibrationData"]