From a5dbc1adeaa0d790206580d5f94c7503808ea1f0 Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Thu, 29 Oct 2020 13:51:58 +0300 Subject: refactoring --- kvmd/plugins/hid/serial.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'kvmd/plugins/hid/serial.py') diff --git a/kvmd/plugins/hid/serial.py b/kvmd/plugins/hid/serial.py index d5de1cc7..9bfafc69 100644 --- a/kvmd/plugins/hid/serial.py +++ b/kvmd/plugins/hid/serial.py @@ -45,11 +45,12 @@ class _SerialPhyConnection(BasePhyConnection): def __init__(self, tty: serial.Serial) -> None: self.__tty = tty - def send(self, request: bytes, receive: int) -> bytes: + def send(self, request: bytes) -> bytes: + assert len(request) == 8 if self.__tty.in_waiting: self.__tty.read_all() - assert self.__tty.write(request) == len(request) - return self.__tty.read(receive) + assert self.__tty.write(request) == 8 + return self.__tty.read(4) class _SerialPhy(BasePhy): -- cgit v1.2.3