Skip to content

Commit

Permalink
Update usblib.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler authored Dec 1, 2023
1 parent d1ca2d6 commit 6127b1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mtkclient/Library/Connection/usblib.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,16 @@ def usbread(self, resplen=None, maxtimeout=100):
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:
Expand All @@ -454,7 +455,6 @@ def usbread(self, resplen=None, maxtimeout=100):
self.verify_data(res[:resplen], "RX:")
return res[:resplen]


def usbxmlread(self, maxtimeout=100):
res = bytearray()
timeout = 0
Expand Down

0 comments on commit 6127b1e

Please sign in to comment.