summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorJack Ren <jack.ren@intel.com>2011-08-12 18:39:04 +0800
committerJack Ren <jack.ren@intel.com>2012-05-09 23:08:12 +0800
commit1c4b760a5d41de3196572d50d1404e453174cf9a (patch)
tree3822976e0fed2b201c1aacd74e7e759d4986a477 /adb
parentd98c87c95342ed6eade9f1239122dc9e90dcad67 (diff)
downloadcore-1c4b760a5d41de3196572d50d1404e453174cf9a.tar.gz
core-1c4b760a5d41de3196572d50d1404e453174cf9a.tar.bz2
core-1c4b760a5d41de3196572d50d1404e453174cf9a.zip
adb: usb_windows: fix adb connection lost issue
Windows adb connection could be lost if the target side kernel enables the kmemleak. The root cause is that kmemleak downgrades USB performance, and lead to Windows adb host application timeout because usb_write()/usb_read()'s timeout time is very short. That issue is not reproducible in Linux host because its usb_write() timeout is 5s and usb_read() is blocked until return: usb_write() usb_read() Linux 5000ms blocked until return Windows 500+len*8 ms 500+len*8 ms To fix that issue, extend the Windows adb host usb_write timeout time to 5 seconds and usb_read() as a blocked routine: usb_write() usb_read() Windows 5000ms blocked until return Change-Id: If54e2b4c396a5a06318c0ee0b3326a00e7661fbc Signed-off-by: Yu Wang <yu.y.wang@intel.com> Signed-off-by: Jin Can Zhuang <jin.can.zhuang@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Diffstat (limited to 'adb')
-rw-r--r--adb/usb_windows.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/adb/usb_windows.c b/adb/usb_windows.c
index b216999bb..251bf1720 100644
--- a/adb/usb_windows.c
+++ b/adb/usb_windows.c
@@ -255,7 +255,7 @@ usb_handle* do_usb_open(const wchar_t* interface_name) {
}
int usb_write(usb_handle* handle, const void* data, int len) {
- unsigned long time_out = 500 + len * 8;
+ unsigned long time_out = 5000;
unsigned long written = 0;
int ret;
@@ -300,7 +300,7 @@ 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 = 500 + len * 8;
+ unsigned long time_out = 0;
unsigned long read = 0;
int ret;
@@ -322,7 +322,7 @@ int usb_read(usb_handle *handle, void* data, int len) {
if (len == 0)
return 0;
- } else if (saved_errno != ERROR_SEM_TIMEOUT) {
+ } else {
// assume ERROR_INVALID_HANDLE indicates we are disconnected
if (saved_errno == ERROR_INVALID_HANDLE)
usb_kick(handle);