forked from M-Labs/artiq
parent
c0030406c3
commit
0a6fcd9fa0
|
@ -108,7 +108,10 @@ class CommGeneric:
|
||||||
if ty != _D2HMsgType.IDENT_REPLY:
|
if ty != _D2HMsgType.IDENT_REPLY:
|
||||||
raise IOError("Incorrect reply from device: {}".format(ty))
|
raise IOError("Incorrect reply from device: {}".format(ty))
|
||||||
(reply, ) = struct.unpack("B", self.read(1))
|
(reply, ) = struct.unpack("B", self.read(1))
|
||||||
runtime_id = self.read(4).decode()
|
runtime_id = chr(reply)
|
||||||
|
for i in range(3):
|
||||||
|
(reply, ) = struct.unpack("B", self.read(1))
|
||||||
|
runtime_id += chr(reply)
|
||||||
if runtime_id != "AROR":
|
if runtime_id != "AROR":
|
||||||
raise UnsupportedDevice("Unsupported runtime ID: {}"
|
raise UnsupportedDevice("Unsupported runtime ID: {}"
|
||||||
.format(runtime_id))
|
.format(runtime_id))
|
||||||
|
@ -235,11 +238,9 @@ class CommGeneric:
|
||||||
length, ty = self._read_header()
|
length, ty = self._read_header()
|
||||||
if ty != _D2HMsgType.LOG_REPLY:
|
if ty != _D2HMsgType.LOG_REPLY:
|
||||||
raise IOError("Incorrect request from device: "+str(ty))
|
raise IOError("Incorrect request from device: "+str(ty))
|
||||||
log = self.read(length - 9).decode()
|
r = ""
|
||||||
try:
|
for i in range(length - 9):
|
||||||
idx = log.index("\x00")
|
c = struct.unpack("B", self.read(1))[0]
|
||||||
except ValueError:
|
if c:
|
||||||
pass
|
r += chr(c)
|
||||||
else:
|
return r
|
||||||
log = log[:idx]
|
|
||||||
return log
|
|
||||||
|
|
Loading…
Reference in New Issue