1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

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
2 changed files with 4 additions and 4 deletions

View File

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

View File

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