This commit is contained in:
Devaev Maxim 2020-06-04 07:54:26 +03:00
parent 9cee98310d
commit 9e60f24c54

View File

@ -320,7 +320,6 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
if not self.__noop: if not self.__noop:
if tty.in_waiting: if tty.in_waiting:
tty.read(tty.in_waiting) tty.read(tty.in_waiting)
assert tty.write(request) == len(request) assert tty.write(request) == len(request)
response = tty.read(4) response = tty.read(4)
else: else:
@ -333,7 +332,7 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
else: else:
assert len(response) == 4, response assert len(response) == 4, response
if self.__make_crc16(response[-4:-2]) != struct.unpack(">H", response[-2:])[0]: if self.__make_crc16(response[-4:-2]) != struct.unpack(">H", response[-2:])[0]:
get_logger().error("Invalid response CRC; requesting response again ...") logger.error("Invalid response CRC; requesting response again ...")
request = self.__make_request(b"\x02\x00\x00\x00\x00") # Repeat an answer request = self.__make_request(b"\x02\x00\x00\x00\x00") # Repeat an answer
else: else:
code = response[1] code = response[1]