Commit graph

2261 commits

Author SHA1 Message Date
Casey Dahlin
bd2c93fab0 Enable mDNS on Darwin
am: 304150a521

Change-Id: Id0d77614fc3bf580c2879b9ad801c77dcbfc7752
2017-03-10 01:16:31 +00:00
Casey Dahlin
cef0c7cf7d Don't include mDNS support on platforms other than Linux
am: d6c8091e9f

Change-Id: Ife0b6e08098c05288c3ea63e9063e5116335716a
2017-03-10 01:16:18 +00:00
Casey Dahlin
b298855764 Add mDNS device discovery for adb client
am: 13a269ea24

Change-Id: Ib5f80b3ccc9db7c6fe6f5c989e82083d734ce4df
2017-03-10 01:16:05 +00:00
Casey Dahlin
f18d33c2c6 adb: Set a hostname for mDNS
am: 1fe3cae67e

Change-Id: Iea8700ec13502e58774968cd7383255f769fa105
2017-03-10 01:15:49 +00:00
Casey Dahlin
cc9c92fa95 Make ADBD announce its presence over mDNS
am: 6cd5e0b4ef

Change-Id: Ida2f133f72087f291f2d34e968503ae81c3fbd50
2017-03-10 01:15:31 +00:00
Josh Gao
9d13bc2160 Merge "adb: append the libwinpthread COPYING to adb's NOTICE."
am: c1b3c8ef26

Change-Id: I4de6f83ea394635710b4e89cc1818233b6605eca
2017-03-09 07:48:01 +00:00
Josh Gao
d3bf1a8d7e adb: append the libwinpthread COPYING to adb's NOTICE.
We statically link libwinpthread into Windows binaries, but soong
currently can't specify notice files for toolchain_libraries. Add
libwinpthread's COPYING info directly to adb's as a hack.

Bug: http://b/36073965
Test: `make PRODUCT-sdk-win_sdk` + manual inspection of NOTICE.txt
Change-Id: I58d6be0ecf5626b67308f7e94128a2cd44dab161
2017-03-08 21:27:59 -08:00
Badhri Jagan Sridharan
a37bc179de Merge "adb: Do not signal gaget stack unless descriptors are written"
am: eab4c62e22

Change-Id: Ia04e413a6f3a0e3fcb1e8e52aa822accb808f1fb
2017-03-08 19:39:43 +00:00
Badhri Jagan Sridharan
43fd1a4ea7 adb: Do not signal gaget stack unless descriptors are written
While recovering from endpoint errors, the gadget stack was being
signalled even when desriptors were NOT being rewritten. Avoid this
as this might cause enumeration loops.

Bug: 36036550
Change-Id: Iff2b2fc8cded001ef3c77dc170dce3b96848970c
2017-03-07 19:20:54 -08:00
Casey Dahlin
304150a521 Enable mDNS on Darwin
We have to disable IPv6 to get this going, but nobody was yet using
IPv6, so that should be fine for now.

Test: Verified mDNS discovery on a MacBook
Bug: 31042497
(cherry picked from 9ae65de087171072f3890a81b074ae27db319508)

Change-Id: I628f0a1e9c4784db42fa56f5faf2904b6e1cf548
2017-03-07 14:45:52 -08:00
Casey Dahlin
d6c8091e9f Don't include mDNS support on platforms other than Linux
Test: Shamu build now passes
Bug: None
(cherry picked from 122a7738606d854d6dc10fa361c1d7296cc9670a)

Change-Id: I650adf0bca96fb655163f5e9b27d9995ae448ec2
2017-03-07 14:45:52 -08:00
Casey Dahlin
13a269ea24 Add mDNS device discovery for adb client
Test: Was able to discover a raspberry pi.
Bug: 28074466
(cherry picked from e292cd16760321fccc99c8c261cb92fa4b6462ab)

Change-Id: Id9571576457a4a0a078e48a274a4e8eac78bfe2b
2017-03-07 14:45:51 -08:00
Casey Dahlin
1fe3cae67e adb: Set a hostname for mDNS
Now all devices won't appear as "Android." Should make it easier to
multiplex.

Test: Verified locally on a raspberry pi 3
Bug: 28887278
(cherry picked from 815b23319635d264ae0ce2c8c29a5776a57b8051)

Change-Id: Icfd0116477543af6a3049c14d818c1cff7fc3b93
2017-03-07 14:44:38 -08:00
Casey Dahlin
6cd5e0b4ef Make ADBD announce its presence over mDNS
We now request mdnsd from adb and register a service of type _adb._tcp
for clients to connect to.

Test: Verified service appears in avahi-browse
Bug: 28074466
(cherry picked from 379ac414e4d9f53388d903913022a55695292775)

Change-Id: Ie871b9c8b40e86063cc1e68e8f3e4290ead2d279
2017-03-07 14:42:06 -08:00
Josh Gao
ef501512fa Merge "adb: turn on libusb by default."
am: 817b2f3b2c

Change-Id: Iaeefdcc45a5b96243b0b47822361d71c6e154b6e
2017-03-04 00:31:11 +00:00
Josh Gao
f2f0b31850 adb: turn on libusb by default.
Bug: http://b/31321337
Test: python test_device.py
Change-Id: Idb2ff1108331bf505feeeb943b6be7bb78124618
2017-03-02 13:23:56 -08:00
Bo Hu
8c35491151 Merge "DO NOT MERGE ANYWHERE Qemu-pipe: refactor qemu_pipe.h into libqemu_pipe" 2017-03-02 18:03:30 +00:00
bohu
294d44be33 DO NOT MERGE ANYWHERE Qemu-pipe: refactor qemu_pipe.h into libqemu_pipe
Traditionally, qemu_pipe has both the declaration and implentation of each
function in one header file--qemu_pipe.h, and it is getting incovenient to
maintain.

This CL separates the implementation of functions from the header file,
and makes qemu_pipe a static library for other modules to link to.

Note that the interface and implementation of qemu_pipe are kept unchanged,
and future CLs will enhance the implementation to make it more reliable and
more compatible with old and new API levels.

Following projects are affected by this refactoring, and they are modified
accordingly:

device/generic/goldfish
device/generic/goldfish-opengl
hardware/ril/reference-ril

Change-Id: I541ecbf0cc7eadeef9d4e37ffd9ca7bfcc5c94c0
2017-03-01 16:33:44 -08:00
Colin Cross
58021d15c9 Move adb_dirname and adb_basename to libbase
adb already provides an implementation of dirname and basename that
take and produce std::strings, move it into libbase so it can be
used in the implementation of GetExecutableDirectory.

Test: out/host/linux-x86/nativetest64/adb_test/adb_test
Test: out/host/linux-x86/nativetest64/libbase_test/libbase_test
Test: adb shell /data/nativetest64/libbase_test/libbase_test64
Change-Id: Ideb1627607b14562121316d4ed27fa6fb0930684
2017-02-27 18:18:31 -08:00
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