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:
1 parent
5ae1a014ff
commit
4fcf9cf3d7
1 file changed
+10
-1
@@ -15,8 +15,17 @@ APP_BASE = 0x08001000
|
||||
PORT = "COM16"
|
||||
|
||||
|
||||
def open_port(port):
|
||||
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):
|
||||
|
||||
Reference in new issue
Block a user