system/core
修订版 | 574645c708ddd7794de10588eaba08c956dec783 (tree) |
---|---|
时间 | 2012-07-11 16:35:57 |
作者 | Jack Ren <jack.ren@inte...> |
Commiter | Chih-Wei Huang |
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:
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:
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>
@@ -255,7 +255,7 @@ usb_handle* do_usb_open(const wchar_t* interface_name) { | ||
255 | 255 | } |
256 | 256 | |
257 | 257 | int usb_write(usb_handle* handle, const void* data, int len) { |
258 | - unsigned long time_out = 500 + len * 8; | |
258 | + unsigned long time_out = 5000; | |
259 | 259 | unsigned long written = 0; |
260 | 260 | int ret; |
261 | 261 |
@@ -300,7 +300,7 @@ int usb_write(usb_handle* handle, const void* data, int len) { | ||
300 | 300 | } |
301 | 301 | |
302 | 302 | int usb_read(usb_handle *handle, void* data, int len) { |
303 | - unsigned long time_out = 500 + len * 8; | |
303 | + unsigned long time_out = 0; | |
304 | 304 | unsigned long read = 0; |
305 | 305 | int ret; |
306 | 306 |
@@ -322,7 +322,7 @@ int usb_read(usb_handle *handle, void* data, int len) { | ||
322 | 322 | |
323 | 323 | if (len == 0) |
324 | 324 | return 0; |
325 | - } else if (saved_errno != ERROR_SEM_TIMEOUT) { | |
325 | + } else { | |
326 | 326 | // assume ERROR_INVALID_HANDLE indicates we are disconnected |
327 | 327 | if (saved_errno == ERROR_INVALID_HANDLE) |
328 | 328 | usb_kick(handle); |