Commit graph

6 commits

Author SHA1 Message Date
Josh Gao
3705b346b9 adb: make adb reconnect perform a USB reset.
Bug: http://b/128941083
Test: manual
Change-Id: Iaf46d2c46cc82b590768004486d119244591c8e2
2019-03-28 15:47:44 -07:00
Josh Gao
9425996b45 adb: get libusb compiling on Windows.
This still doesn't work yet because libusb doesn't support hotplug on
Windows yet, but it's in the milestones for the next libusb release,
and this is enough to start poking around with the WinUSB device-side
stuff, so leave it broken for now.

Bug: http://b/68993980
Test: set ADB_LIBUSB=1; adb.exe server nodaemon aborts in the expected place
Change-Id: Icef7d46e31c847d6a8e724c6f58ae5db43673c16
2017-12-08 13:11:15 -08:00
Josh Gao
01b7bc43e9 adb: move all cleanup to a function with defined ordering.
We want to explicitly define the order in which we teardown adb, so
move all of the at_quick_exits sprinkled throughout into one function
containing all of the cleanup functions.

Bug: http://b/37104408
Test: adb kill-server; adb start-server
Change-Id: I394f5782eb147e394d4b87df1ba364c061de4b90
2017-05-09 14:32:47 -07:00
Josh Gao
ef3d343254 adb: use the actual wMaxPacketSize for usb endpoints.
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-05-03 12:32:39 -07:00
Josh Gao
5d1756ceb5 adb: add adb host-features, report libusb status.
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-02-22 18:19:21 -08:00
Josh Gao
1c70e1bcbc adb: add libusb implementation for Linux/Darwin.
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
2017-01-25 13:52:53 -08:00