From b09aee76443bab081db2624439f79d3cfca67304 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sun, 31 Jan 2021 14:40:14 +0100 Subject: [PATCH] Filter out virtual vcs devices (#2489) * Filter out virtual vcs devices * fix test --- supervisor/hardware/helper.py | 2 +- tests/hardware/test_helper.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/supervisor/hardware/helper.py b/supervisor/hardware/helper.py index 45844e922..55a0443d3 100644 --- a/supervisor/hardware/helper.py +++ b/supervisor/hardware/helper.py @@ -17,7 +17,7 @@ _LOGGER: logging.Logger = logging.getLogger(__name__) _PROC_STAT: Path = Path("/proc/stat") _RE_BOOT_TIME: re.Pattern = re.compile(r"btime (\d+)") -_RE_HIDE_SYSFS: re.Pattern = re.compile(r"/sys/devices/virtual/(?:tty|block)/.*") +_RE_HIDE_SYSFS: re.Pattern = re.compile(r"/sys/devices/virtual/(?:tty|block|vc)/.*") class HwHelper(CoreSysAttributes): diff --git a/tests/hardware/test_helper.py b/tests/hardware/test_helper.py index 1a6fa07f6..65b938057 100644 --- a/tests/hardware/test_helper.py +++ b/tests/hardware/test_helper.py @@ -69,7 +69,10 @@ def test_hide_virtual_device(coresys): udev_device.sys_path = "/sys/devices/virtual/block/test" assert coresys.hardware.helper.hide_virtual_device(udev_device) - udev_device.sys_path = "/sys/devices/virtual/tty/test" + udev_device.sys_path = "/sys/devices/virtual/tty/tty1" + assert coresys.hardware.helper.hide_virtual_device(udev_device) + + udev_device.sys_path = "/sys/devices/virtual/vc/vcs1" assert coresys.hardware.helper.hide_virtual_device(udev_device)