Commit graph

2242 commits

Author SHA1 Message Date
Josh Gao
87eb0fc3d0 Merge "Revert "adb: remove win32 dependency on libwinpthread-1.dll."" 2017-02-24 21:02:25 +00:00
Sandeep Patil
f134fe07b8 adb: early-mount: fix verity toggle through adb for early mount
verity toggle through adb failed to work for early mount due to fstab
entries being moved into kernel/dt. This change fixes that by using the
new fs_mgr_read_fstab_default() api that will make sure all fstab
entries (from dt as well as from /fstab.{ro.hardware}) are combined
before returning the fstab object.

b/27805372

Test: early mount /system and /vendor on angler.
- test adb disable-verity && adb root to ensure rebooted instance
doesn't have 'partition.system.verified' property set. i.e. verity is
indeed disabled.

- test adb enable-verity && adb root to ensure rebooted instance does
have 'partition.system.verified' property set, i.e. verity is enabled.
also verified by trying to do 'adb remount' which correctly warns about
verity

Change-Id: Iffdcc0a0b959a65c326219bd4e9e41cba9ec7c88
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-02-23 16:48:52 -08:00
Josh Gao
3d4d973e82 Revert "adb: remove win32 dependency on libwinpthread-1.dll."
This reverts commit c2e984eec8.

Move the change to build/make, so that other win32 binaries get this as
well.
2017-02-23 13:16:52 -08: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
Treehugger Robot
1d73abb443 Merge "adb: remove win32 dependency on libwinpthread-1.dll." 2017-02-22 02:06:40 +00:00
Josh Gao
c2e984eec8 adb: remove win32 dependency on libwinpthread-1.dll.
Explicitly link against the static libwinpthread.a to avoid a
dependency on the dll.

Also, make the tests link against libbase statically.

Bug: http://b/31665213
Test: wine adb.exe
Test: wine adb_test.exe
Change-Id: Ifd41afcb1756a4b9b6db12e102b4db502e73d846
2017-02-21 15:30:11 -08:00
Jerry Zhang
f3fb7de3c8 adb: set max_rw to USB_FFS_BULK_SIZE explicitly
Sometimes when endpoint_alloc returns ENODEV,
max_rw will end up being a value that is too
big.

Bug: 35634401
Test: push/pull files
Change-Id: Iaa81a3311b1855e2a835562cdf7a46ff4399feb1
2017-02-21 14:37:07 -08:00
Elliott Hughes
9eb551868b adbd's children should have SIGPIPE set to SIG_DFL.
POSIX lets you choose whether or not SIGPIPE disposition is inherited,
and Linux chose "yes". Work around that.

Bug: http://b/35209888
Test: "ps -A | head" without the toybox workaround
Change-Id: I6b5afa3d87eb2af04b24c6c37fa338ab60ad2336
2017-02-17 11:14:33 -08:00
Jerry Zhang
05fe272a87 adb: Lower EP_ALLOC retry count
Retries were causing timeouts on some devices.

Bug: 35418581
Test: Change usb config
Change-Id: Ie80d9eba1cb9af0acee49bd7312842533a94a87b
2017-02-16 10:56:05 -08:00
Jerry Zhang
b5a34a2bce adb: Add bMaxBurst to superspeed descriptors
This gives a large boost to speed on usb 3.0.

Test: adb pull/push multi GB files
Bug: 31722483
Change-Id: Iea039f1aba8b2e4d7e4a2ecb504cccb5dd1e4629
2017-02-13 18:19:41 -08:00
Jerry Zhang
2f8c60b1cc adb: Set max socket sizes to larger values.
This improves performance of push/pull.

Test: adb push/pull multi GB files.
Bug: 31722483
Change-Id: Ia01574c3db6a740d7a7e64ba1f5bc1fc279fb3f6
2017-02-13 18:19:36 -08:00
Jerry Zhang
55205a565b adb: Pre allocate kernel memory
This allows reliable use of larger buffer sizes.
Max r/w size is set only when that preallocation
is successful so that memory is guaranteed to be
available.

Bug: 31722483
Test: adb push with multi GB files
Change-Id: Ia0459ca051988abb144645871792e8f840dd3ff7
2017-02-13 14:20:47 -08:00
Elliott Hughes
2ec36b0da0 Don't print 168^W143 lines of help when someone makes a typo.
Print actual usage messages in most cases.

Add --help and --version.

Bug: http://b/28054087
Test: manual
Change-Id: I39c1cb7a84f52e0c35d24f140ec55c3a181283fb
2017-02-06 16:20:30 -08:00
Nick Kralevich
aced420f20 usb_dispatch.cpp: Lower severity of logging statement.
The first time you run adb, it starts the adbd server and annoyingly
generates the following message:

adb I 02-01 11:57:58 99717 99717 usb_dispatch.cpp:30] using native
backend

Drop the severity of the message to avoid visible spammy messages only
intended for debugging.

Test: code compiles and no more log message in normal adb use
Change-Id: I882092a6cd14bc67980d88416397d51ab8393b1b
2017-02-01 12:05:18 -08:00
Josh Gao
06766a8b29 adb: fix darwin build.
Bug: none
Test: mma on mac
Change-Id: I49ef3c4892c7942a235d317d90386c7d8a872868
2017-01-26 14:01:34 -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
Josh Gao
4c38a921c2 Merge changes I21eefab9,I0ac7d78a
* changes:
  adb: move usb_* to client/usb_*.
  adb: reorganize adbd USB handling code.
2017-01-25 21:52:45 +00:00
Josh Gao
fb9a7e5995 adb: check for and report inotify_init1 failure.
Bug: http://b/34396687
Test: mma
Change-Id: I55ea84db49017a6533ac54db5072e3e75ba30097
2017-01-20 15:26:00 -08:00
Josh Gao
456e1ad420 adb: move usb_* to client/usb_*.
Bug: http://b/31321337
Test: mma
Change-Id: I21eefab953737e87d211959616ac4f48926dd92c
2017-01-19 15:49:55 -08:00
Josh Gao
44c688ca19 adb: reorganize adbd USB handling code.
Break adbd's USB initialization code into its own static library to
allow it to be used by benchmark code that pretends to be adbd.

Bug: http://b/31289465
Test: adb shell works on bullhead
Change-Id: I0ac7d78a4f7aef59bd6d14fc5cf1ed870e1f3a9d
2017-01-19 13:19:45 -08:00
Josh Gao
cbe70cb0a8 debuggerd: advance our amazing bet.
Remove debuggerd in favor of a helper process that gets execed by
crashing processes.

Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906
2017-01-17 13:57:57 -08:00
Elliott Hughes
83ab5c29c1 -e is really about TCP/IP devices, not emulators.
Despite the name.

Bug: N/A
Test: N/A
Change-Id: I099222137fabf68f961a6a2e5d11f2904ffd5a0d
2017-01-13 16:58:25 -08:00
Josh Gao
72d4c42cd5 Merge "adb: remove support for legacy f_adb interface." 2017-01-12 21:24:34 +00:00
Josh Gao
183b73e665 adb: remove support for legacy f_adb interface.
Everything should be using the functionfs interface instead by now.

Bug: http://b/34228376
Test: grepping for f_adb, android_adb in source tree
Test: m
Change-Id: I6bc41049c49a867499832588dac8ed108c636c11
2017-01-11 15:00:03 -08:00
Alex Deymo
705353ae27 Remove "_static" and "_host" suffix from libext4_utils.
Bug: 34220783
Change-Id: I967dbaa9c48ad1feed2369c3a40f745b86a350f8
2017-01-11 14:05:42 -08:00
Tao Bao
40e0ec918e adb: Fix the 'adb reboot sideload' for A/B devices.
We used to write the command file (/cache/recovery/command) to trigger
the sideload mode. A/B devices don't support that (may not have /cache
paritition). This CL switches to using libbootloader_message which
writes the command to BCB (bootloader control block) instead.

Test: "adb root && adb reboot sideload" reboots sailfish into recovery
      sideload mode.

Change-Id: I158fd7cbcfa9a5d0609f1f684a2d03675217628f
2017-01-05 18:01:01 -08:00
Treehugger Robot
94dd4b7410 Merge "adb: fix adb trace tag" 2016-12-17 00:07:41 +00:00
Josh Gao
a27666b823 adb: don't require adb keys to be named "*.adb_key".
Don't require the extension on explicit file paths passed on; only
check for it in monitored directories.

Bug: http://b/33638233
Test: ADB_TRACE=1 ADB_VENDOR_KEYS=$HOME/foo adb server nodaemon
Change-Id: I7387e0bbe0f2e16878bf22b05d5c6e8d0f9e5a92
2016-12-14 17:05:36 -08:00
Treehugger Robot
e69e9be7b6 Merge "adb: remove extraneous stat in sync_recv." 2016-12-14 21:11:23 +00:00
Daniel Friederich
b644134858 adb: fix adb trace tag
The ADB trace enum value collided with the 0 values used to mean all, hence it
was not possible to just trace the ADB tagged messages without also tracing everything else.

Change-Id: I15ff9c50c4ac01806c4841cf8213ce859faf130b
Test: Manually by setting ADB_TRACE and running adb, e.g. "ADB_TRACE=adb adb shell ls"
2016-12-14 12:41:43 -06:00
Josh Gao
52df920fd6 adb: add script to trace adbd.
Bug: http://b/31289465
Test: sh trace.sh
Change-Id: Id6e20e83742541aec6bfd9f4112adbdadc078f74
2016-12-13 14:31:17 -08:00
Josh Gao
f0f854bc76 adb: retry install_listener for a while.
install_listener can fail if we told a previous adb server to quit and
it hasn't finished doing so yet. Retry it for a few hundred
milliseconds to avoid this.

Bug: http://b/28618716
Test: nc -l 5037; adb server nodaemon
Change-Id: Ibbda8f2718b85a2b6a08985aa8d29aa2204a3ead
2016-12-12 18:20:57 -08:00
Josh Gao
aac1145a5b adb: remove extraneous stat in sync_recv.
We do a remote stat to get the file's size before pulling in sync_recv,
but all of the callers to sync_recv have already done a stat. Pass the
expected file size into sync_recv to remove its stat.

Bug: http://b/31289465
Test: python test_device.py
Change-Id: I7ca8ed11c6134e5954acac86626f880ade3ec696
2016-12-12 16:47:34 -08:00
Josh Gao
cfe72e290b adb: add tracing to transport.cpp.
Bug: http://b/31289465
Test: systrace
Change-Id: I41968f447b61ef1eea2b933a5fd8623605c4dea6
2016-12-12 12:28:45 -08:00
Josh Gao
1290fbf5eb adb: clang-format transport.cpp
Bug: http://b/31289465
Test: none
Change-Id: If99a9f1d4d6fa1d34b0ac3bbfc7f2e6bfc188ff2
2016-12-12 12:28:45 -08:00
Josh Gao
fd12aaa8c1 adb: add tracing to file_sync_service.cpp.
Bug: http://b/31289465
Test: systrace
Change-Id: I186675ca0310ace0e1d35561fa0b910417dcedd7
2016-12-12 12:28:45 -08:00
Bill Yi
a794775592 Merge remote-tracking branch 'goog/stage-aosp-master' into HEAD 2016-12-06 15:07:48 -08:00
Josh Gao
5a1e3fdaf8 Revert "Revert "adb: extend sync protocol's stat support.""
This reverts commit afa4b5d6eb.

Add functions to translate errno to and from the linux asm-generic
values, since mips has different values.

Bug: http://b/33058958
Test: python test_device.py with both old and new adbd
Change-Id: I1a122235f3e793ed10b3bf3ad293388015134150
2016-12-05 17:38:30 -08:00
Josh Gao
a3577e1ac5 Revert "Revert "adb: move adb_strerror to sysdeps/win32/errno.cpp.""
This reverts commit 43c02b27cd.

Test: mma
Change-Id: I6b22ead8a4b964973ee2fdb8deba42bea74880cf
2016-12-05 17:38:30 -08:00
Josh Gao
bad5069cc0 Revert "adb: extend sync protocol's stat support."
am: afa4b5d6eb

Change-Id: I5fbf0e936685b320d322d4a8e1b1671f2d0da8cf
2016-12-05 21:23:44 +00:00
Josh Gao
3cad1843f8 Revert "adb: move adb_strerror to sysdeps/win32/errno.cpp."
am: 43c02b27cd

Change-Id: I5a4a050fdbf05910edf2e55dfb8442e30e88464e
2016-12-05 21:23:38 +00:00
Josh Gao
afa4b5d6eb Revert "adb: extend sync protocol's stat support."
This reverts commit d6d5c38469.
2016-12-05 13:16:02 -08:00
Josh Gao
43c02b27cd Revert "adb: move adb_strerror to sysdeps/win32/errno.cpp."
This reverts commit 4fba3d2638.
2016-12-05 13:15:55 -08:00
Josh Gao
d5286d376b adb: move adb_strerror to sysdeps/win32/errno.cpp.
am: 4fba3d2638

Change-Id: Ibdfa8ebbcfee5baf459f82fd13e1a0e8167c5053
2016-12-05 20:35:41 +00:00
Josh Gao
4733b631ed adb: extend sync protocol's stat support.
am: d6d5c38469

Change-Id: I26a1518bba4f65c0fdcc7c75d751badd9a3563d3
2016-12-05 20:35:36 +00:00
Josh Gao
97e228e903 Merge changes I9df4d6fa,I841123de
* changes:
  adb: move adb_strerror to sysdeps/win32/errno.cpp.
  adb: extend sync protocol's stat support.
2016-12-05 20:31:55 +00:00
Elliott Hughes
32ca0ab616 Merge "Remove unused adb_set_transport."
am: b898ce00fa

Change-Id: Ia428922f1a0241b8d7ec97517d360b02596a9781
2016-12-03 04:23:10 +00:00
Elliott Hughes
de80be39aa Remove unused adb_set_transport.
Bug: N/A
Test: builds
Change-Id: I0824d29c080c47e1002abf3520ebed8996bcbcc6
2016-12-02 12:53:09 -08:00
Josh Gao
4fba3d2638 adb: move adb_strerror to sysdeps/win32/errno.cpp.
Bug: none
Test: mma
Change-Id: I9df4d6faf9883a78f50ca6b2b7c35f095d06ae20
2016-11-30 13:23:21 -08:00
Josh Gao
d6d5c38469 adb: extend sync protocol's stat support.
Extend the file sync protocol to support calling regular stat (instead
of lstat), return error codes, and provide the entire stat struct.

Bug: http://b/33058958
Test: python test_device.py with both old and new adbd
Change-Id: I841123debc380f86194a19e91c97d85160112144
2016-11-30 13:23:21 -08:00