forked from M-Labs/artiq
moninj: fix read of incomplete data (#1729)
This commit is contained in:
parent
ebb67eaeee
commit
30e5e06a33
|
@ -82,12 +82,12 @@ class CommMonInj:
|
||||||
if not ty:
|
if not ty:
|
||||||
return
|
return
|
||||||
if ty == b"\x00":
|
if ty == b"\x00":
|
||||||
payload = await self._reader.read(9)
|
payload = await self._reader.readexactly(9)
|
||||||
channel, probe, value = struct.unpack(
|
channel, probe, value = struct.unpack(
|
||||||
self.endian + "lbl", payload)
|
self.endian + "lbl", payload)
|
||||||
self.monitor_cb(channel, probe, value)
|
self.monitor_cb(channel, probe, value)
|
||||||
elif ty == b"\x01":
|
elif ty == b"\x01":
|
||||||
payload = await self._reader.read(6)
|
payload = await self._reader.readexactly(6)
|
||||||
channel, override, value = struct.unpack(
|
channel, override, value = struct.unpack(
|
||||||
self.endian + "lbb", payload)
|
self.endian + "lbb", payload)
|
||||||
self.injection_status_cb(channel, override, value)
|
self.injection_status_cb(channel, override, value)
|
||||||
|
|
Loading…
Reference in New Issue