From 7a53f1445619fc471c2823e7081de8b6039b938e Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Wed, 18 Sep 2024 04:37:43 +0300 Subject: refactoring --- kvmd/plugins/hid/_mcu/proto.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'kvmd/plugins/hid/_mcu/proto.py') diff --git a/kvmd/plugins/hid/_mcu/proto.py b/kvmd/plugins/hid/_mcu/proto.py index 76cd5d09..deaf5c15 100644 --- a/kvmd/plugins/hid/_mcu/proto.py +++ b/kvmd/plugins/hid/_mcu/proto.py @@ -184,17 +184,17 @@ class MouseWheelEvent(BaseEvent): # ===== -def check_response(response: bytes) -> bool: - assert len(response) in (4, 8), response - return (bitbang.make_crc16(response[:-2]) == struct.unpack(">H", response[-2:])[0]) +def check_response(resp: bytes) -> bool: + assert len(resp) in (4, 8), resp + return (bitbang.make_crc16(resp[:-2]) == struct.unpack(">H", resp[-2:])[0]) -def _make_request(command: bytes) -> bytes: - assert len(command) == 5, command - request = b"\x33" + command - request += struct.pack(">H", bitbang.make_crc16(request)) - assert len(request) == 8, request - return request +def _make_request(cmd: bytes) -> bytes: + assert len(cmd) == 5, cmd + req = b"\x33" + cmd + req += struct.pack(">H", bitbang.make_crc16(req)) + assert len(req) == 8, req + return req # ===== -- cgit v1.2.3