Pick the last USB device port

This commit is contained in:
Ivan Kravets
2022-05-15 13:13:45 +03:00
parent e5e2210768
commit d01d314f47
3 changed files with 6 additions and 6 deletions

2
docs

Submodule docs updated: a57afb023a...30e2c2d667

View File

@ -50,15 +50,15 @@ def scan_serial_port(
if port:
return port
# pick the first PID:VID USB device
# pick the last PID:VID USB device
usb_port = None
for item in list_serial_ports():
if ensure_ready and not is_serial_port_ready(item["port"]):
continue
port = item["port"]
if "VID:PID" in item["hwid"]:
return port
return port
usb_port = port
return usb_port or port
def match_serial_port(pattern):