Commit 38d9c24e562372afc7fa2afa2d7da74eb90df599

Con Kolivas 2013-11-03T20:16:45

Copy known transferred amount back to buffer for usb reads instead of requested length.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/usbutils.c b/usbutils.c
index fa18523..4f4512a 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2483,7 +2483,7 @@ usb_bulk_transfer(struct libusb_device_handle *dev_handle, int intinfo,
 		} while (err && ++retries < USB_RETRY_MAX);
 	}
 	if ((endpoint & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_IN)
-		memcpy(data, buf, length);
+		memcpy(data, buf, *transferred);
 
 	return err;
 }