diff options
| author | David Krause <david.krause@motorola.com> | 2011-03-08 14:10:16 +0800 |
|---|---|---|
| committer | David Krause <david.krause@motorola.com> | 2011-03-28 11:45:21 -0500 |
| commit | 913eb8bf874fcec647667bd7113da65b6e38488a (patch) | |
| tree | 36bd45d4774148d36f70100e17af58e62aea1967 /fastboot/usb_windows.c | |
| parent | 7c556549079dbcc3f6f7ef4376978cd8c598aa62 (diff) | |
| download | core-913eb8bf874fcec647667bd7113da65b6e38488a.tar.gz core-913eb8bf874fcec647667bd7113da65b6e38488a.tar.bz2 core-913eb8bf874fcec647667bd7113da65b6e38488a.zip | |
Enlarge USB bulk transfer size for faster downloads
The default USB transfer bulk is fixed as 4096 in fastboot util code for
Windows and Linux. Enlarging the bulk size can greatly improve the image
download speed via USB.
For Windows, adjust the max bulk size to 1MB to maximize the USB transfer
speed. With this change, the USB transfer speed can be doubled to 20MB/s.
For Linux, adjust the max bulk size to 16384 to maximize the USB transfer
speed according to MAX_USBFS_BUFFER_SIZE definition in drivers/usb/core/devio.c.
For OSX, the maxLenToSend is already 1MB in code.
Change-Id: If6af8c6301f6f6c2ef345e37241706f16d8f5cda
Diffstat (limited to 'fastboot/usb_windows.c')
| -rw-r--r-- | fastboot/usb_windows.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fastboot/usb_windows.c b/fastboot/usb_windows.c index 54008a423..1050293d7 100644 --- a/fastboot/usb_windows.c +++ b/fastboot/usb_windows.c @@ -42,6 +42,7 @@ #define DBG(x...) #endif +#define MAX_USBFS_BULK_SIZE (1024 * 1024) /** Structure usb_handle describes our connection to the usb device via AdbWinApi.dll. This structure is returned from usb_open() routine and @@ -160,7 +161,7 @@ int usb_write(usb_handle* handle, const void* data, int len) { if (NULL != handle) { // Perform write while(len > 0) { - int xfer = (len > 4096) ? 4096 : len; + int xfer = (len > MAX_USBFS_BULK_SIZE) ? MAX_USBFS_BULK_SIZE : len; ret = AdbWriteEndpointSync(handle->adb_write_pipe, (void*)data, (unsigned long)xfer, @@ -200,7 +201,7 @@ int usb_read(usb_handle *handle, void* data, int len) { DBG("usb_read %d\n", len); if (NULL != handle) { while (1) { - int xfer = (len > 4096) ? 4096 : len; + int xfer = (len > MAX_USBFS_BULK_SIZE) ? MAX_USBFS_BULK_SIZE : len; ret = AdbReadEndpointSync(handle->adb_read_pipe, (void*)data, |
