Skip to content

Commit

Permalink
vcu118-run.py: Don't depend on endpoint iteration order for TTY
Browse files Browse the repository at this point in the history
The documentation explicitly states there is no order, so make sure we
pick up the right TTY from the dual port UART. On tiger this seems to be
getting them backwards.
  • Loading branch information
jrtc27 committed Sep 13, 2024
1 parent 24ebf4e commit 114e70e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions vcu118-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,19 @@ def find_vcu118_tty(pretend: bool) -> ListPortInfo:
# find the serial port:
expected_vendor_id = 0x10C4
expected_product_id = 0xEA70
expected_endpoint = ":1.1"
for portinfo in comports(include_links=True):
assert isinstance(portinfo, ListPortInfo)
if portinfo.pid == expected_product_id and portinfo.vid == expected_vendor_id:
if (
portinfo.pid == expected_product_id
and portinfo.vid == expected_vendor_id
and portinfo.location.endswith(expected_endpoint)
):
return portinfo
if pretend:
return ListPortInfo("/dev/fakeTTY")
raise ValueError("Could not find USB TTY with VID", hex(expected_vendor_id), "PID", hex(expected_product_id))
raise ValueError("Could not find USB TTY with VID", hex(expected_vendor_id), "PID", hex(expected_product_id),
"endpoint", expected_endpoint)


def main():
Expand Down

0 comments on commit 114e70e

Please sign in to comment.