From 61ee830ec93059f022903d48677c1c6211cd1757 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 22 Jul 2015 15:59:06 -0700 Subject: [PATCH] Don't limit Windows USB reads. In 3d2904cdf2371e26c0465184436bd063979a5d97 we removed the code that broke Linux USB reads into 4KiB chunks. This patch does the same for Windows. This improves Windows "adb pull" speeds 6x in my VM. (There was no equivalent problem with writes, so this change only affects pull speeds.) Change-Id: If19013e5f51975f4824bf9147b7b76cebd305b96 --- adb/usb_windows.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/adb/usb_windows.cpp b/adb/usb_windows.cpp index 25deb1bea..4c9a1526b 100644 --- a/adb/usb_windows.cpp +++ b/adb/usb_windows.cpp @@ -298,20 +298,13 @@ int usb_write(usb_handle* handle, const void* data, int len) { int usb_read(usb_handle *handle, void* data, int len) { unsigned long time_out = 0; unsigned long read = 0; - int ret; D("usb_read %d\n", len); - if (NULL != handle) { + if (handle != nullptr) { while (len > 0) { - int xfer = (len > 4096) ? 4096 : len; - - ret = AdbReadEndpointSync(handle->adb_read_pipe, - data, - (unsigned long)xfer, - &read, - time_out); + int ret = AdbReadEndpointSync(handle->adb_read_pipe, data, len, &read, time_out); int saved_errno = GetLastError(); - D("usb_write got: %ld, expected: %d, errno: %d\n", read, xfer, saved_errno); + D("usb_write got: %ld, expected: %d, errno: %d\n", read, len, saved_errno); if (ret) { data = (char *)data + read; len -= read;