mirror of https://github.com/m-labs/artiq.git
device/thorlabs_tcube: fix port read
This commit is contained in:
parent
50888865e7
commit
3c09577ed0
|
@ -193,12 +193,12 @@ class _Tcube:
|
||||||
await self.port.write(message.pack())
|
await self.port.write(message.pack())
|
||||||
|
|
||||||
async def recv(self):
|
async def recv(self):
|
||||||
header = await self.port.read(6)
|
header = await self.port.read_exactly(6)
|
||||||
logger.debug("received header: %s", header)
|
logger.debug("received header: %s", header)
|
||||||
data = b""
|
data = b""
|
||||||
if header[4] & 0x80:
|
if header[4] & 0x80:
|
||||||
(length, ) = st.unpack("<H", header[2:4])
|
(length, ) = st.unpack("<H", header[2:4])
|
||||||
data = await self.port.read(length)
|
data = await self.port.read_exactly(length)
|
||||||
r = Message.unpack(header + data)
|
r = Message.unpack(header + data)
|
||||||
logger.debug("receiving: %s", r)
|
logger.debug("receiving: %s", r)
|
||||||
return r
|
return r
|
||||||
|
|
Loading…
Reference in New Issue