diff options
author | Maxim Devaev <[email protected]> | 2021-10-03 01:48:39 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2021-10-03 01:48:39 +0300 |
commit | 1c3155daecfe56c97fd5e3ca9514f96805344649 (patch) | |
tree | 7b22063f61c964fa062d365c9eef1c7f64cc7b38 /kvmd | |
parent | d0c237c177ecbbb77b106888f3dec973ffeac03f (diff) |
xk-hk4401: fixed regexp
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/plugins/ugpio/xh_hk4401.py | 8 |
1 files 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: |