From 291c5da31ae00eec7b86b27f956fad2b77ca1c24 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Sat, 15 Mar 2025 10:59:29 -0400 Subject: [PATCH] flashtool: can bridge uuid detection fix Handle exceptions if the conversion from USB serial number to uuid fails for can bridge devices. Abort detection as the can bridge device cannot be flashed in one step. Signed-off-by: Eric Callahan --- scripts/flashtool.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/flashtool.py b/scripts/flashtool.py index 3dbe78e..590f45a 100755 --- a/scripts/flashtool.py +++ b/scripts/flashtool.py @@ -755,7 +755,15 @@ class CanSocket(BaseSocket): f"Found Klipper USB-CAN bridge on {can_intf}, serial {serial_no}" ) if serial_no: - det_uuid = convert_usbsn_to_uuid(serial_no) + try: + det_uuid = convert_usbsn_to_uuid(serial_no) + except Exception: + output_line( + f"Failed to convert can bridge serial number {serial_no} " + f"to a uuid for device {item.name}" + ) + logging.exception("UUID conversion failed") + return logging.info( f"Detected UUID: {det_uuid:x}, provided UUID: {self._uuid:x}" )