From 1c3155daecfe56c97fd5e3ca9514f96805344649 Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Sun, 3 Oct 2021 01:48:39 +0300 Subject: [PATCH] xk-hk4401: fixed regexp --- kvmd/plugins/ugpio/xh_hk4401.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/kvmd/plugins/ugpio/xh_hk4401.py b/kvmd/plugins/ugpio/xh_hk4401.py index 1406cdb6..4f681b8f 100644 --- a/kvmd/plugins/ugpio/xh_hk4401.py +++ b/kvmd/plugins/ugpio/xh_hk4401.py @@ -169,15 +169,13 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute channel: Optional[int] = None if tty.in_waiting: data += tty.read_all() - found = re.findall(b"AG0[0-4]gA", data) - data = data[-12:] - + found = re.findall(b"AG0[1-4]gA", data) if found: try: channel = int(found[-1][2:4]) - 1 except Exception: - return (None, data) - assert 0 <= channel <= 3 + channel = None + data = data[-12:] return (channel, data) def __send_channel(self, tty: serial.Serial, channel: int) -> None: