From 016fd24859696bad6016e7bdfa3b33e11b02dc06 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 18 Aug 2020 15:03:30 +0200 Subject: [PATCH] Fix hardware serial list check (#1943) --- supervisor/misc/hardware.py | 7 +++---- tests/misc/test_hardware.py | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/supervisor/misc/hardware.py b/supervisor/misc/hardware.py index 07db2fb75..72de4a15b 100644 --- a/supervisor/misc/hardware.py +++ b/supervisor/misc/hardware.py @@ -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 diff --git a/tests/misc/test_hardware.py b/tests/misc/test_hardware.py index 7ac2e1ece..246374991 100644 --- a/tests/misc/test_hardware.py +++ b/tests/misc/test_hardware.py @@ -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", []), ]