refactoring

This commit is contained in:
Maxim Devaev 2022-01-24 19:09:30 +03:00
parent a614be7d76
commit 2396e87b70

View File

@ -1,6 +1,6 @@
# ========================================================================== # # ========================================================================== #
# # # #
# KVMD - The main Pi-KVM daemon. # # KVMD - The main PiKVM daemon. #
# # # #
# Copyright (C) 2018-2022 Maxim Devaev <mdevaev@gmail.com> # # Copyright (C) 2018-2022 Maxim Devaev <mdevaev@gmail.com> #
# # # #
@ -182,14 +182,12 @@ class Plugin(BaseUserGpioDriver): # pylint: disable=too-many-instance-attribute
# Set a channel by sending PS [1-16] # Set a channel by sending PS [1-16]
# Note that the recv is 0-based index, while send is 1-based. We add 1 to the "channel" to # Note that the recv is 0-based index, while send is 1-based. We add 1 to the "channel" to
# normalize for the 1-based index on send # normalize for the 1-based index on send
cmd = (b"PS") tty.write(b"PS %d\r" % (channel + 1))
tty.write(b"%s %d\r" % (cmd, channel + 1))
tty.flush() tty.flush()
def __reset(self, tty: serial.Serial) -> None: def __reset(self, tty: serial.Serial) -> None:
# Reset by sending PS without port number # Reset by sending PS without port number
cmd = (b"PS") tty.write(b"PS\r")
tty.write(b"%s\r" % (cmd))
tty.flush() tty.flush()
def __str__(self) -> str: def __str__(self) -> str: