Commit graph

298 commits

Author SHA1 Message Date
Josh Gao
b2ea09115c Merge "adb: turn CHECKs into an error + transport restart." am: ad0f27fe72
am: 7373282999

Change-Id: I60415fb9fefb59585e27ba4181a9a69168709758
2019-06-18 21:28:08 -07:00
Josh Gao
7c3b87ffd2 Merge "Revert "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."" am: a6f90ce599
am: 099fc95530

Change-Id: Iaa1d67735ed8a4c582c42b630cf90c2c384fd2f6
2019-06-14 16:55:35 -07:00
Josh Gao
9dba0f5824 Revert "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."
We're only reading FUNCTIONFS_BIND on creation upon the first creation
of the control fd, which results in an abort when rebind happens (e.g.
when MTP is enabled) and we unexpectedly read FUNCTIONFS_BIND in the
second instantiation of the connection.

This reverts commit 2b668d3906.

Bug: http://b/135155652
Test: manually enabled MTP
2019-06-14 16:21:21 -07:00
Josh Gao
fc0f80ae49 adb: turn CHECKs into an error + transport restart.
These CHECKs are expected to happen if the client does the wrong thing,
so we probably shouldn't be aborting in adbd.

Bug: http://b/133872605
Bug: http://b/134695864
Test: treehugger
Change-Id: I875b87a06ba9d399db26f8af1ad47ccf34e9445a
2019-06-13 13:16:57 -07:00
Josh Gao
db51d08cc8 Merge "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND." am: cb2352a75d
am: b965eea9c6

Change-Id: I81d74942931f8ede3e0c29d1ecef08d3f4f8149c
2019-06-12 07:53:09 -07:00
Josh Gao
2b668d3906 adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.
Rework the functionfs logic to avoid rebinding the USB interface
repeatedly.

Bug: http://b/133132986
Test: treehugger
Change-Id: I7f75874efd197764d40b66800a117ff4726d793b
2019-06-11 20:33:16 -07:00
Josh Gao
8e707dede9 Merge changes I2d005e17,If2eec162,Icfd642e6 am: 2683d0a2ca
am: 961b03661a

Change-Id: I8a6957e1944389d2d6b162fdc8d97b430f353fbe
2019-06-04 19:31:37 -07:00
Josh Gao
a00228b646 Merge "adbd: provide MS OS descriptors for WinUSB." am: a891ffddd3
am: 91aa2ef730

Change-Id: I6c6e0675358e748c1228ce87626726fdccb2f533
2019-06-04 19:25:24 -07:00
Josh Gao
2683d0a2ca Merge changes I2d005e17,If2eec162,Icfd642e6
* changes:
  adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
  adbd: respond to device-to-host control transfers.
  adbd: read, print, and ignore USB control transfers.
2019-06-04 19:22:08 +00:00
Josh Gao
a891ffddd3 Merge "adbd: provide MS OS descriptors for WinUSB." 2019-06-04 19:22:00 +00:00
chihhao.chen
c097a5786d Merge "Fix non-aio USB read issue for fastbootd" into qt-dev
am: 9122289a97

Change-Id: I0274561a806f027452bf814a8e0cafbd5a7e0a85
2019-05-29 16:34:29 -07:00
TreeHugger Robot
9122289a97 Merge "Fix non-aio USB read issue for fastbootd" into qt-dev 2019-05-29 23:11:55 +00:00
chihhao.chen
8c544b6fd8 Fix non-aio USB read issue for fastbootd
non-aio USB read function was stuck in a loop waiting for more data
because data length parameter is always set 64 for fastbootd commands.
It should be a normal case to get less data than expected
since lengths of these commands are usually less than 64.
Add logic to check this and one more parameter to distinguish
fastbootd from general adbd case.

Bug: 133189029
Test: try various fastbootd commands
Change-Id: I6690324840d78f3f1e04235040301520329976db
Merged-In: I6690324840d78f3f1e04235040301520329976db
2019-05-29 23:10:50 +00:00
chihhao.chen
5f8b966d96 Fix non-aio USB read issue for fastbootd
non-aio USB read function was stuck in a loop waiting for more data
because data length parameter is always set 64 for fastbootd commands.
It should be a normal case to get less data than expected
since lengths of these commands are usually less than 64.
Add logic to check this and one more parameter to distinguish
fastbootd from general adbd case.

Bug: 133189029
Test: try various fastbootd commands
Change-Id: I6690324840d78f3f1e04235040301520329976db
2019-05-29 12:41:55 -07:00
Hemant Kumar
1cbe5edbc3 adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
Bug: http://b/129283234
Test: treehugger
Change-Id: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
2019-05-28 17:53:24 -07:00
Josh Gao
43a0a9a5bf adbd: respond to device-to-host control transfers.
Failing to write to the endpoint results in subsequent reads on ep0 to
fail with EL2HLT, so do an empty write to fulfill the transfer.

Bug: http://b/131867920
Test: manually tested with modified auto client
Change-Id: If2eec162ca4b31a9974c7bd5802be51cee9e2708
Merged-In: If2eec162ca4b31a9974c7bd5802be51cee9e2708
(cherry-picked from internal commit af086e9a95)
2019-05-28 17:52:11 -07:00
Josh Gao
fc2e2003dd adbd: read, print, and ignore USB control transfers.
It seems like we're blowing up when receiving a control transfer that's
intended for Android Auto, because we're not expecting to get the data
for the control transfer in a subsequent read.

Bug: http://b/131867920
Test: none
Change-Id: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
Merged-In: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
(cherry-picked from internal commit 12807c7012)
2019-05-28 17:51:05 -07:00
Josh Gao
527d6dd738 Merge "adbd: respond to device-to-host control transfers." into qt-dev
am: 8ef22b102c

Change-Id: Ia371254756e7d951064607226b4f9cfc67832c0b
2019-05-22 16:15:04 -07:00
Josh Gao
db64696b7c adbd: provide MS OS descriptors for WinUSB.
Add Microsoft OS Descriptors so that on Windows, we get automatically
registered with the WinUSB driver instead of requiring a different INF
to be used with device with a different vendor ID.

Bug: http://b/68993980
Test: manually changed the vendor ID on a blueline and connected it to a Windows VM
Change-Id: Id78bae270df9805573a90a86019267b53a3c8252
2019-05-22 14:58:13 -07:00
Josh Gao
af086e9a95 adbd: respond to device-to-host control transfers.
Failing to write to the endpoint results in subsequent reads on ep0 to
fail with EL2HLT, so do an empty write to fulfill the transfer.

Bug: http://b/131867920
Test: manually tested with modified auto client
Change-Id: If2eec162ca4b31a9974c7bd5802be51cee9e2708
2019-05-21 16:39:51 -07:00
Josh Gao
26a6faf0ae Merge "adbd: read, print, and ignore USB control transfers." into qt-dev
am: 6031286936

Change-Id: I3e1a2052406b3399f7e11176ac2aca1adcb20f52
2019-05-20 17:17:31 -07:00
TreeHugger Robot
7eeed22871 Merge "adbd: reduce queue depths." into qt-dev 2019-05-21 00:05:34 +00:00
TreeHugger Robot
5b882637e1 Merge "adbd: avoid starting multiple worker threads." into qt-dev 2019-05-21 00:04:15 +00:00
Josh Gao
12807c7012 adbd: read, print, and ignore USB control transfers.
It seems like we're blowing up when receiving a control transfer that's
intended for Android Auto, because we're not expecting to get the data
for the control transfer in a subsequent read.

Bug: http://b/131867920
Test: none
Change-Id: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
2019-05-17 18:34:23 -07:00
Evgenii Stepanov
9da358d6d3 Initialize all fields of struct iocb.
Kernel does not accept non-zero value of iocb->aio_reserved2.

Bug: 132803232
Test: initialize malloc() memory to non-zero pattern and see what breaks

Change-Id: I65a7e89e3a2c1ba79df1dc2d011d6c76c41afb81
(cherry picked from commit fe7eca7b8f)
2019-05-16 12:55:41 -07:00
Evgenii Stepanov
79b1dc0106 Merge "Initialize all fields of struct iocb." am: 6e06bcce9c
am: 37c81fd6f0

Change-Id: I3c8155e222b7e7f4277d5654f85e7006a777dd16
2019-05-16 00:03:37 -07:00
Evgenii Stepanov
fe7eca7b8f Initialize all fields of struct iocb.
Kernel does not accept non-zero value of iocb->aio_reserved2.

Bug: 132803232
Test: initialize malloc() memory to non-zero pattern and see what breaks

Change-Id: I65a7e89e3a2c1ba79df1dc2d011d6c76c41afb81
2019-05-15 18:46:18 -07:00
TreeHugger Robot
82ebfca5cd Merge "adbd: don't abort on EOF on functionfs control fd." into qt-dev 2019-05-13 22:21:59 +00:00
Josh Gao
127da2ab6d Merge "adbd: don't abort on EOF on functionfs control fd." am: 41531df7b0
am: f848fac660

Change-Id: I9fda92cd15fa84318759a37606429621a0797d36
2019-05-13 11:58:57 -07:00
Josh Gao
1f7ae9d4e3 adbd: don't abort on EOF on functionfs control fd.
Also, improve the logging in the cases where we do abort.

Bug: http://b/131867920
Test: treehugger
Change-Id: If8ec9f4614ce146e6dbd21cc77587ea81658199b
(cherry picked from commit 2916e148d9)
2019-05-13 11:42:29 -07:00
Josh Gao
41531df7b0 Merge "adbd: don't abort on EOF on functionfs control fd." 2019-05-13 18:40:34 +00:00
Michael Groover
69277fb9c5 Merge "Notify the framework when an adb key is authorized" into qt-dev
am: b9c555e2cf

Change-Id: I664ba3acfb8295ccf7b773e07d2d007ff942bc40
2019-05-10 17:21:47 -07:00
Josh Gao
2916e148d9 adbd: don't abort on EOF on functionfs control fd.
Also, improve the logging in the cases where we do abort.

Bug: http://b/131867920
Test: treehugger
Change-Id: If8ec9f4614ce146e6dbd21cc77587ea81658199b
2019-05-10 11:37:34 -07:00
Josh Gao
0bd7a96967 Merge "Revert "Revert "Add a way to turn off unique_fd's operator int.""" am: fe1d1e815f
am: 0df5a1cb66

Change-Id: I8cc21b88841d6a7b7b93efafbc89939540350214
2019-05-09 22:14:23 -07:00
Michael Groover
7eeda6ba03 Notify the framework when an adb key is authorized
Bug: 124076524
Test: atest AdbDebuggingManagerTest
Change-Id: If73b81ca73ba4d64763cf49c1bbe42de81fa1cb6
2019-05-09 16:05:40 -07:00
Josh Gao
27241a7a96 Revert "Revert "Add a way to turn off unique_fd's operator int.""
The original commit broke aosp-master-with-phones, because of
vendor libraries the depended on the int versions of libbase functions.

This patch reverts the revert, and also adds ABI-compatibility shims for
the replaced functions.

This reverts commit 2c58e1924a.

Bug: http://b/131312539
Test: treehugger
Test: forrest run of aosp-master-with-phones
Change-Id: I75cc84ec8d963e20862f7662e8e2f409471f41cc
2019-05-06 16:18:02 -07:00
Mark Salyzyn
5c812e7a13 Merge "adb: enable/disable verity expected overlayfs errors." am: be9c2c0310
am: 3809014902

Change-Id: Icb7f4cd3c20af1f80fa3ca2b05b906b38111b1e2
2019-05-06 08:38:56 -07:00
Treehugger Robot
be9c2c0310 Merge "adb: enable/disable verity expected overlayfs errors." 2019-05-06 14:36:51 +00:00
Elliott Hughes
f774bcc942 Merge "libbase: add ConsumePrefix/ConsumeSuffix." am: 7046bcb461
am: 9f6f62a485

Change-Id: Ie328e1a6da12ace87ebb2da65cbc649a1c972039
2019-05-03 17:48:43 -07:00
Josh Gao
a31aa2e749 Merge "adbd: move posix_fadvise after open." am: 19322dddc6
am: c97b258c42

Change-Id: I10f91ee1cedd16c1f803c3bdff9253fe3bca6841
2019-05-03 17:25:51 -07:00
Elliott Hughes
7046bcb461 Merge "libbase: add ConsumePrefix/ConsumeSuffix." 2019-05-04 00:03:14 +00:00
Treehugger Robot
19322dddc6 Merge "adbd: move posix_fadvise after open." 2019-05-03 23:23:59 +00:00
Mark Salyzyn
5828b77a3d adb: enable/disable verity expected overlayfs errors.
Expect EBUSY for overlayfs teardown, and ENOENT for setup.

Test: adb-remount-test.sh
Bug: 131614849
Change-Id: I0fb351d6d5fe758021c9e9043f57863c7a194c12
2019-05-03 14:44:49 -07:00
Elliott Hughes
b4dc7be6c5 libbase: add ConsumePrefix/ConsumeSuffix.
adb was already using ConsumePrefix, and now we have another would-be
user in cutils. (There appears to be one place in adb that should use
ConsumeSuffix, so I'm assuming we'll want that sooner or later.)

I've kept these inline because adb and google3's versions both were, and
I'm easily led.

Test: treehugger
Change-Id: I29d99032f6f6ccbfaefece59725db8afb02a4c87
2019-05-03 12:49:31 -07:00
Josh Gao
d594359e7f Merge "adbd: avoid starting multiple worker threads." am: 5ddd49eeae
am: dcfc785d20

Change-Id: Id5fbaba786214b2d5b9dcab7f433ce12f850d35d
2019-05-02 14:33:26 -07:00
Josh Gao
94fb36bf77 adbd: avoid starting multiple worker threads.
A previous patch intended to make receiving multiple FUNCTIONFS_ENABLEs
non-fatal, but failed to do so because we would try to spawn another
worker thread and hit a different assertion.

Bug: http://b/130638368
Test: echo mem | adb shell "su 0 sh -c 'cat > /sys/power/state'"
Change-Id: I53456112244d8b4f7d26df6ec6961389fca70498
(cherry picked from commit 910ce0ff08)
2019-05-02 14:13:14 -07:00
Josh Gao
910ce0ff08 adbd: avoid starting multiple worker threads.
A previous patch intended to make receiving multiple FUNCTIONFS_ENABLEs
non-fatal, but failed to do so because we would try to spawn another
worker thread and hit a different assertion.

Bug: http://b/130638368
Test: echo mem | adb shell "su 0 sh -c 'cat > /sys/power/state'"
Change-Id: I53456112244d8b4f7d26df6ec6961389fca70498
2019-05-01 17:27:27 -07:00
Josh Gao
b5d1d19269 adbd: move posix_fadvise after open.
Test: treehugger
Change-Id: I531e452eda46d7df3106fd59192e9936e64876b1
2019-05-01 13:40:01 -07:00
Ian Kasprzak
19187f1bfc Merge "Revert "Add a way to turn off unique_fd's operator int."" am: e30fe5fe89
am: e285dbeae3

Change-Id: I8a4911e8b6970c3b0defef66dc109358ff2d6748
2019-04-25 10:30:15 -07:00
Ian Kasprzak
e30fe5fe89 Merge "Revert "Add a way to turn off unique_fd's operator int."" 2019-04-25 17:16:55 +00:00