2026 dongle: race SignalRGB for the port in safeboot_flash too

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 4.8 committed 2026-11-14 23:22:22 +01:00
1 parent 5ae1a014ff
commit 4fcf9cf3d7
1 file changed
+11 -2
+11 -2
View File
@@ -15,8 +15,17 @@ APP_BASE = 0x08001000
PORT = "COM16" PORT = "COM16"
def open_port(port): def open_port(port, open_timeout=20.0):
return serial.Serial(port, 115200, timeout=0.3) """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): def enter_flash(s):