Fix bulk transfer dropping messages sometimes (#729)

* fix max messages per bulk transfer

* retry on partial send

* need 2x the packet size for some reason

* improve bulk write test
This commit is contained in:
Greg Hogan
2021-10-15 18:14:55 -07:00
committed by GitHub
parent f5c7e1ada1
commit c5adfa4ece
3 changed files with 16 additions and 5 deletions

View File

@@ -533,7 +533,13 @@ class Panda(object):
for s in snds:
self._handle.bulkWrite(3, s)
else:
self._handle.bulkWrite(3, b''.join(snds), timeout=timeout)
dat = b''.join(snds)
while True:
bs = self._handle.bulkWrite(3, dat, timeout=timeout)
dat = dat[bs:]
if len(dat) == 0:
break
print("CAN: PARTIAL SEND MANY, RETRYING")
break
except (usb1.USBErrorIO, usb1.USBErrorOverflow):
print("CAN: BAD SEND MANY, RETRYING")