Update usblib.py

This commit is contained in:
Bjoern Kerler 2023-12-01 19:14:58 +01:00 committed by GitHub
parent d1ca2d6554
commit 6127b1ecb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -424,15 +424,16 @@ class usb_class(DeviceClass):
wMaxPacketSize = self.EP_IN.wMaxPacketSize
extend = res.extend
buffer = None
buflen=min(resplen,wMaxPacketSize)
if self.fast:
buffer = self.buffer[:resplen]
buffer = self.buffer[:buflen]
while len(res) < resplen:
try:
if self.fast:
rlen = epr(buffer, timeout)
extend(buffer[:rlen])
else:
extend(epr(resplen))
extend(epr(buflen))
except usb.core.USBError as e:
error = str(e.strerror)
if "timed out" in error:
@ -454,7 +455,6 @@ class usb_class(DeviceClass):
self.verify_data(res[:resplen], "RX:")
return res[:resplen]
def usbxmlread(self, maxtimeout=100):
res = bytearray()
timeout = 0