From 114e70e2c77db1ce9f612acd9f950b4e32731254 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Fri, 13 Sep 2024 22:31:57 +0100 Subject: [PATCH] vcu118-run.py: Don't depend on endpoint iteration order for TTY 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. --- vcu118-run.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vcu118-run.py b/vcu118-run.py index c13c990ae..1dff503fe 100755 --- a/vcu118-run.py +++ b/vcu118-run.py @@ -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():