Fix hardware serial list check (#1943)

This commit is contained in:
Pascal Vizeli 2020-08-18 15:03:30 +02:00 committed by GitHub
parent d315e81ab2
commit 016fd24859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -89,10 +89,9 @@ class Hardware:
"""Return all serial and connected devices.""" """Return all serial and connected devices."""
dev_list: List[Device] = [] dev_list: List[Device] = []
for device in self.devices: for device in self.devices:
if ( if device.subsystem != "tty" or (
device.subsystem != "tty" "ID_VENDOR" not in device.attributes
or "ID_VENDOR" not in device.attributes and not RE_TTY.search(str(device.path))
or not RE_TTY.search(str(device.path))
): ):
continue continue

View File

@ -58,6 +58,7 @@ def test_serial_devices():
assert [(device.name, device.links) for device in system.serial_devices] == [ assert [(device.name, device.links) for device in system.serial_devices] == [
("ttyACM0", []), ("ttyACM0", []),
("ttyUSB0", [Path("/dev/serial/by-id/xyx")]), ("ttyUSB0", [Path("/dev/serial/by-id/xyx")]),
("ttyS0", []),
] ]