comm_mgmt: fix read_expect

This commit is contained in:
mwojcik 2022-05-19 15:25:20 +08:00 committed by Sébastien Bourdeauducq
parent 4bdb4c8e11
commit d24a36a02a

View File

@ -110,9 +110,10 @@ class CommMgmt:
return ty
def _read_expect(self, ty):
if self._read_header() != ty:
header = self._read_header()
if header != ty:
raise IOError("Incorrect reply from device: {} (expected {})".
format(self._read_type, ty))
format(header, ty))
def _read_int32(self):
(value, ) = struct.unpack(self.endian + "l", self._read(4))