Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 651253f

Browse files
committed
Fix short reads on handles
Fixes #5.
1 parent 05339fb commit 651253f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

adb/adb_protocol.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,12 @@ def Read(cls, usb, expected_cmds, timeout_ms=None, total_timeout_ms=None):
226226
cmd, (timeout_ms, total_timeout_ms))
227227

228228
if data_length > 0:
229-
data = usb.BulkRead(data_length, timeout_ms)
229+
data = ''
230+
while data_length > 0:
231+
temp = usb.BulkRead(data_length, timeout_ms)
232+
data += temp
233+
data_length -= len(temp)
234+
230235
actual_checksum = cls.CalculateChecksum(data)
231236
if actual_checksum != data_checksum:
232237
raise InvalidChecksumError(

0 commit comments

Comments
 (0)