summaryrefslogtreecommitdiff
path: root/transport_usb.cpp
AgeCommit message (Collapse)Author
2017-07-26adbd: add logging to troubleshoot usb issues.Josh Gao
Bug: http://b/63899881 Bug: http://b/63901259 Bug: http://b/63904904 Test: treehugger Change-Id: Ifbc3caa6b416093bf8e127194003747c910352dc
2017-06-26Revert "adb: turn on libusb by default."Josh Gao
This reverts commit f2f0b318508fec66fc07044b34f602960f399e5b. libusb seems to be causing flakiness on some machines. Disable it for now. Bug: http://b/62962248 Test: python test_device.py (with DeviceOfflineTest commented out) Change-Id: Ia9de78ab772c22574cf5ca7facb78f22af6d7a71
2017-05-18adb: boolify check_header and check_data.Josh Gao
Test: grep Change-Id: I8d0c60e500bba855a1afc0877253262246c07fef
2017-05-03adb: use the actual wMaxPacketSize for usb endpoints.Josh Gao
Previously, adb was assuming a fixed maximum packet size of 1024 bytes (the value for an endpoint connected via USB 3.0). When connected to an endpoint that has an actual maximum packet size of 512 bytes (i.e. every single device over USB 2.0), the following could occur: device sends amessage with 512 byte payload client reads amessage client tries to read payload with a length of 1024 In this scenario, the kernel will block, waiting for an additional packet which won't arrive until something else gets sent across the wire, which will result in the previous read failing, and the new packet being dropped. Bug: http://b/37783561 Test: python test_device.py on linux/darwin, with native/libusb Change-Id: I556f5344945e22dd1533b076f662a97eea24628e
2017-04-20adb: fix two device offline problems.Yabin Cui
When device goes offline, user usually has to manually replug the usb device. This patch tries to solve two offline situations, all because when adb on host is killed, the adbd on device is not notified. 1. When adb server is killed while pushing a large file to device, the device is still reading the unfinished large message. So the device thinks of the CNXN message as part of the previous unfinished message, so it doesn't reply and the device is in offline state. The solution is to add a write_msg_lock in atransport struct. And it kicks the transport only after sending a whole message. By kicking all transports before exit, we ensure that we don't write part of a message to any device. So next time we start adb server, the device should be waiting for a new message. 2. When adb server is killed while pulling a large file from device, the device is still trying to send the unfinished large message. So adb on host usually reads data with EOVERFLOW error. This is because adb on host is reading less than one packet sent from device. The solution is to use buffered read on host. The max packet size of bulk transactions in USB 3.0 is 1024 bytes. By preparing an at least 1024 bytes buffer when reading, EOVERFLOW no longer occurs. And teach adb host to ignore wrong messages. To be safe, this patch doesn't change any logic on device. Bug: http://b/32952319 Test: run python -m unittest -q test_device.DeviceOfflineTest Test: on linux/mac/windows with bullhead, ryu. Change-Id: Ib149d30028a62a6f03857b8a95ab5a1d6e9b9c4e
2017-03-02adb: turn on libusb by default.Josh Gao
Bug: http://b/31321337 Test: python test_device.py Change-Id: Idb2ff1108331bf505feeeb943b6be7bb78124618
2017-02-22adb: add `adb host-features`, report libusb status.Josh Gao
Add a 'host-features' command to get the features of the currently running host adb server. Abuse it to report libusb status. Bug: http://b/34983123 Test: adb host-features; adb kill-server; ADB_LIBUSB=1 adb start-server; adb host-features Change-Id: I0e8d503a2dbdff9002ebb6ce8a298498a9421422
2017-01-25adb: add libusb implementation for Linux/Darwin.Josh Gao
Add a libusb-based implementation alongside the existing native implementations, controlled by the ADB_LIBUSB environment variable. Windows will need more work for the usb driver. Bug: http://b/31321337 Test: python test_device.py on linux/darwin, with ADB_LIBUSB=0 and 1 Change-Id: Ib68fb2c6c05475eae3ff4cc19f55802a6f489bb7
2016-10-10Remove useless arguments from is_adb_interface.Josh Gao
Test: mma Change-Id: I8b7b411d7d5ec9d401b61ed8f817b98c61114d4f
2016-04-18Fix kick_transport test.Yabin Cui
Fix broken kick_transport test, and make it not access atransport internal variables. Bug: 25935458 Change-Id: I91b4d32a222b2f369f801bbe3903acac9c8ea4f7
2015-09-23Adb: use VLOG() to replace D() for verbose logging.Yabin Cui
As there are too many D(), we can keep both VLOG() and D() now, and get rid of D() gradually. Change-Id: I2f1cb70bcab3e82c99fed939341d03f6b2216076
2015-09-02adb: clean up debug tracing a little.Yabin Cui
Always use LOG() for debug tracing. Remove useless D_lock. I believe it is useless to lock just before and after fprintf. I verified the log output both on host and on device. The output looks fine to me. Change-Id: I96ccfe408ff56864361551afe9ad464d197ae104
2015-08-11Remove confusing variable HOST.Yabin Cui
First, HOST is always 0 in adbd, which matches ADB_HOST=0. Second, HOST is always 1 when adb_main is called, which matches ADB_HOST=1. For adb client that doesn't call adb_main, it never touches local_init(), init_transport_registration() and fdevent_loop(). So the changes in adb.cpp, services.cpp and transport_local.cpp do nothing with it. As a conclusion, I think we can remove HOST and use ADB_HOST instead. Change-Id: Ide0e0eca7468b6c3c130f6b50974406280678b2e
2015-07-22Increase size of the the adb packets sent over the wireTamas Berghammer
The reason behing this change is to increase the adb push/pull speed with reduceing the number of packets sent between the host and the device because the communication is heavily bound by packet latency. The change maintains two way compatibility in the communication protocol with negotiating a packet size between the target and the host with the CONNECT packets. After this change the push/pull speeds improved significantly (measured from Linux-x86_64 with 100MB of data): | Old push | Old pull || New push | New pull | ----------------------------------------------------------- Hammerhead | 4.6 MB/s | 3.9 MB/s || 13.1 MB/s | 16.5 MB/s | ----------------------------------------------------------- Volantis | 6.0 MB/s | 6.2 MS/s || 25.9 MB/s | 29.0 MB/s | ----------------------------------------------------------- Fugu | 6.0 MB/s | 5.1 MB/s || 27.9 MB/s | 33.2 MB/s | ----------------------------------------------------------- Change-Id: Id9625de31266e43394289e325c7e7e473379c5d8
2015-05-18Make connection states a proper type.Dan Albert
Change-Id: I809f9b327c832b88dd63151bf7dcb012d88e81c4
2015-03-19File header cleanup.Dan Albert
* sysdeps.h should always be included first. * TRACE_TAG needs to be defined before anything is included. * Some files were missing copyright headers. * Save precious bytes on my SSD by removing useless whitespace. Change-Id: I88980e6e00b5be1093806cf286740d9e4a033b94
2015-03-09Move adb to C++.Dan Albert
I keep trying to clean things up and needing std::strings. Might as well just do this now. usb_linux_client.c is going to stay as C because GCC isn't smart enough to deal with the designated initializers it uses (though for some reason it is in C mode). The Darwin files are staying as C because I don't have a way to test that they build. The Windows files are staying as C because while I can actually build for them, it's slow and painful. Change-Id: I75367d29205a9049d34460032b3bb36384f43941