diff --git a/2026-current/dongle/tools/safeboot_flash.py b/2026-current/dongle/tools/safeboot_flash.py index e6f90ae..7dfcf9e 100644 --- a/2026-current/dongle/tools/safeboot_flash.py +++ b/2026-current/dongle/tools/safeboot_flash.py @@ -15,8 +15,17 @@ APP_BASE = 0x08001000 PORT = "COM16" -def open_port(port): - return serial.Serial(port, 115200, timeout=0.3) +def open_port(port, open_timeout=20.0): + """Retry the open to win the race against programs (SignalRGB) that grab + CH340 COM ports on enumeration. Once held, the handle stays ours.""" + t = time.time() + while True: + try: + return serial.Serial(port, 115200, timeout=0.3) + except serial.SerialException: + if time.time() - t > open_timeout: + raise + time.sleep(0.02) def enter_flash(s):