mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-03 19:41:52 +08:00
xk-hk4401: fixed regexp
This commit is contained in:
@@ -169,15 +169,13 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute
|
|||||||
channel: Optional[int] = None
|
channel: Optional[int] = None
|
||||||
if tty.in_waiting:
|
if tty.in_waiting:
|
||||||
data += tty.read_all()
|
data += tty.read_all()
|
||||||
found = re.findall(b"AG0[0-4]gA", data)
|
found = re.findall(b"AG0[1-4]gA", data)
|
||||||
data = data[-12:]
|
|
||||||
|
|
||||||
if found:
|
if found:
|
||||||
try:
|
try:
|
||||||
channel = int(found[-1][2:4]) - 1
|
channel = int(found[-1][2:4]) - 1
|
||||||
except Exception:
|
except Exception:
|
||||||
return (None, data)
|
channel = None
|
||||||
assert 0 <= channel <= 3
|
data = data[-12:]
|
||||||
return (channel, data)
|
return (channel, data)
|
||||||
|
|
||||||
def __send_channel(self, tty: serial.Serial, channel: int) -> None:
|
def __send_channel(self, tty: serial.Serial, channel: int) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user