From 6c62c8e510bae30eacbb811ae020fe3a2bac7cd3 Mon Sep 17 00:00:00 2001 From: Daniel Fox Date: Fri, 17 Oct 2025 08:58:34 -0700 Subject: [PATCH] Fix exiting immediately on i2c permissions error --- monitorcontrol/vcp/vcp_linux.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/monitorcontrol/vcp/vcp_linux.py b/monitorcontrol/vcp/vcp_linux.py index 983bd37..62188f5 100644 --- a/monitorcontrol/vcp/vcp_linux.py +++ b/monitorcontrol/vcp/vcp_linux.py @@ -390,12 +390,20 @@ def get_vcps() -> List[LinuxVCP]: # iterate I2C devices for device in pyudev.Context().list_devices(subsystem="i2c"): - vcp = LinuxVCP(device.sys_number) try: + if sys_no := device.sys_number: + vcp = LinuxVCP(int(sys_no)) + else: + logging.error( + "Unable to check i2c device %s: no device number found", device + ) + continue with vcp: pass except (OSError, VCPIOError): pass + except VCPPermissionError as exc: + logging.error("Unable to check i2c device: %s", exc) else: vcps.append(vcp)