summaryrefslogtreecommitdiffstats
path: root/adb
Commit message (Collapse)AuthorAgeFilesLines
* Fix google-explicit-constructor warnings.Chih-Hung Hsieh2016-04-291-1/+1
| | | | | Bug: 28341362 Change-Id: I4504e98a8db31e0edcbe63c23f9af43eb13e9d86
* adb: decrease the number of fds used in fd_count test.Josh Gao2016-04-261-1/+1
| | | | | | | | Default limit is 1024 fds, which means 512 socketpairs will hit the limit. Bug: http://b/28386497 Change-Id: Ib36404c050e4be3db51378e250f300f7ec5aab13
* adb: fix test_device.py shell protocol checks.David Pursell2016-04-261-5/+5
| | | | | | | | | | | | | https://android-review.googlesource.com/#/c/210646/ added a has_shell_protocol() function but the test_device.py tests were still trying to use the now-missing SHELL_PROTOCOL_FEATURE constant. This CL just switches test_device.py to correctly use the has_shell_protocol() method. Change-Id: Ie0a2f0dc07529843d25051a01e08fb677551a4e1 Test: `python -m unittest discover -v` on devices with and without the shell protocol.
* adb: fix socket tests.Yabin Cui2016-04-252-12/+32
| | | | | | Bug: 28386497 Change-Id: I9f37ecadf3cfc6bb4e5da502d40f49e1f3a16d8a
* Merge "adb: fix adb usb operations on device."Yabin Cui2016-04-251-20/+62
|\
| * adb: fix adb usb operations on device.Yabin Cui2016-04-151-20/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: For devices using /dev/usb-ffs/adb, Run `while true; do adb reconnect device; sleep 1; done`. And the device soon becomes offline. The adbd log shows that calling adb_read(h->bulk_out) in usb_ffs_read() gets EOVERFLOW error. Reason: When kicking a transport using usb-ffs, /dev/usb-ffs/adb/ep0 is not closed, and the device will not notify a usb connection reset to host. So the host will continue to send unfinished packets even if a new transport is started on device. The unfinished packets may not have the same size as what is expected on device, so adbd on device gets EOVERFLOW error. At the worst case, adbd has to create new transports for each unfinished packet. Fixes: The direct fix is to make the usb connection reset when kicking transports, as in https://android-review.googlesource.com/#/c/211267/1. And I think we can make following improvements beside that. 1. Close a file that is used in other threads isn't safe. Because the file descriptor may be reused to open other files, and other threads may operate on the wrong file. So use dup2(dummy_fd) to replace close() in kick function, and really close the file descriptor after the read/write threads exit. 2. Open new usb connection after usb_close() instead of after usb_kick(). After usb_kick(), the transport may still exist and reader/writer for the transport may be still running. But after usb_close(), the previous transport is guaranteed to be destroyed. Bug: 25935458 Change-Id: I1eff99662d1bf1cba66af7e7142f4c0c4d82c01b
* | Fix NULL deref on exec-in with insufficient argumentsZach Riggle2016-04-221-0/+5
| | | | | | | | | | | | | | (cherry-pick of 566a28169b84836fddd5ae96db9b147237ea054f.) Bug: 28152091 Change-Id: Ib59e3bf7f26974aa09d2e6a0e1d9281d7ce25511
* | adb: use a custom thread to poll for usb devices on mac.Yabin Cui2016-04-192-135/+134
| | | | | | | | | | | | | | | | | | | | | | | | On mac, if the adb server kicks a transport on some error, mac usb driver will not report a new usb device. So instead of relying on mac usb driver to report new usb devices, this CL uses a loop to search for usb devices not exist before. Note that this is also the behavior on windows and linux host. `adb reconnect` can be used to verity this CL. Bug: 25935458 Change-Id: I890e0eb1fae173f2e7a0c962ededa294d821e015
* | Merge "Fix kick_transport test."Yabin Cui2016-04-195-88/+36
|\ \
| * | Fix kick_transport test.Yabin Cui2016-04-185-88/+36
| | | | | | | | | | | | | | | | | | | | | | | | Fix broken kick_transport test, and make it not access atransport internal variables. Bug: 25935458 Change-Id: I91b4d32a222b2f369f801bbe3903acac9c8ea4f7
* | | Merge changes Iaf0efc0c,Ia4a2ff77Josh Gao2016-04-183-9/+44
|\ \ \ | | | | | | | | | | | | | | | | | | | | * changes: adb: disable tests that are expected to fail on Win32. adb: increase the FD table size on Win32.
| * | | adb: disable tests that are expected to fail on Win32.Josh Gao2016-04-181-8/+14
| | | | | | | | | | | | | | | | | | | | Bug: http://b/28247676 Change-Id: Iaf0efc0c12835c0915a752a365651eb9bc78b3b8
| * | | adb: increase the FD table size on Win32.Josh Gao2016-04-182-1/+30
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | 128 maximum FDs is a pretty low limit, which can easily be exhausted by port forwarding. Bump the maximum up to 2048, and add a test that checks whether we can actually use a few hundred sockets. Bug: https://code.google.com/p/android/issues/detail?id=12141 Bug: http://b/28246942 Change-Id: Ia4a2ff776e8e58ec13378756f19d80392679ece9
* | | Merge "adb: bump the server version to 36."Josh Gao2016-04-181-1/+1
|\ \ \ | |_|/ |/| |
| * | adb: bump the server version to 36.Josh Gao2016-04-151-1/+1
| |/ | | | | | | | | | | | | | | The recent `adb root` changes are incompatible with older versions of the server. Bump the version number to force the server to restart. Bug: http://b/28194507 Change-Id: I970806e3b68c1f8e3273a4b1f0ecc4aca5086be9
* | Merge "adb: add reconnect command."Yabin Cui2016-04-165-5/+39
|\ \ | |/ |/|
| * adb: add reconnect command.Yabin Cui2016-04-055-5/+39
| | | | | | | | | | | | | | | | | | | | Add reconnect command for debugging. `reconnect` kicks a transport from the host side, `reconnect device` kicks a transport from the device side. They can be used to produce transport errors. Bug: 25935458 Change-Id: I47daa338796b561941e7aba44a51a6dd117d1e98
* | Merge changes Ibc8038b1,I1876ecd7,I57d70f8bTreehugger Robot2016-04-132-31/+23
|\ \ | | | | | | | | | | | | | | | | | | * changes: adb: after `adb root`, wait for the device in any state. adb: add support for 'wait-for-any'. adb: make 'wait-for-{recovery,sideload,bootloader} work.
| * | adb: after `adb root`, wait for the device in any state.Josh Gao2016-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | Otherwise, `adb root` while the device is in recovery will hang. Bug: http://b/28168212 Change-Id: Ibc8038b1745139fb505e466c74c605b9df474c8c
| * | adb: add support for 'wait-for-any'.Josh Gao2016-04-132-4/+6
| | | | | | | | | | | | | | | | | | | | | Allow waiting for a device in any state. Bug: http://b/28168212 Change-Id: I1876ecd70089ca88f2da5de4182e13724ec50501
| * | adb: make 'wait-for-{recovery,sideload,bootloader} work.Josh Gao2016-04-131-29/+19
| | | | | | | | | | | | | | | | | | | | | | | | The help for wait-for-* documents this as working, but we only had a special case for 'wait-for-device'. Make the others work as well. Bug: http://b/28170823 Change-Id: I57d70f8b9a383947c4f761919bfbd8515a013520
* | | Switch fs_mgr and adb to libcrypto_utils.Mattias Nissler2016-04-125-104/+70
|/ / | | | | | | | | | | | | Update code and dependencies to use BoringSSL + libcrypto_utils instead of mincrypt. Change-Id: Ic75164bd50c84b81b6310e27a67d4b3c174984f9
* | Merge "Address const issues in preparation for libcxx rebase."Dan Austin2016-03-303-4/+4
|\ \
| * | Address const issues in preparation for libcxx rebase.Dan Austin2016-03-293-4/+4
| |/ | | | | | | Change-Id: I4eccc1b5a70da9dd325e1a7e10ab0a3fe588c03f
* / Address const issue in preparation for libcxx rebase.Dan Austin2016-03-281-1/+1
|/ | | | Change-Id: I80c3349ee93d2b3f16c6fadc7f34b2bf4f2cc0d3
* Merge "Fix buffer overrun in adb wait-for-device."Elliott Hughes2016-03-111-2/+2
|\
| * Fix buffer overrun in adb wait-for-device.Elliott Hughes2016-03-101-2/+2
| | | | | | | | | | Bug: http://b/27444063 Change-Id: I72339d7215aae28069484b9796d71fe0c53dff96
* | emulator: Use distinct serial names for simultaneous qemu pipes.Prathmesh Prabhu2016-03-101-1/+2
|/ | | | | | | | | | | | | | | | | | | | ADB local transport for the emulator based on qemu pipes uses a socket transport. Before this CL, multiple connection requests accepted by the qemu pipe device would result in ADB transport with the same serial. The register function would fail as a result, and all subsequent connections would fail. Test: while true; do adb kill-server; adb devices; done Doesn't fail for > 10 minutes. This CL replaces an earlier CL (I0fdcf2694516151c5f8f8e1580648b940679c981) that was unsafe for real devices. BUG=27441661 Change-Id: I7d801b175f3bee10fc7e0ab1b12d5623984371b9
* Merge changes I93514d22,I57dbc113,I707ffbd1Josh Gao2016-03-056-37/+107
|\ | | | | | | | | | | | | * changes: adb: wait for restore to complete before returning. adb: wait for adbd to die and respawn in root/unroot. adb: make ScopedFd universally accessible and useful.
| * adb: wait for restore to complete before returning.Josh Gao2016-03-041-0/+3
| | | | | | | | | | | | | | | | If we return before waiting for the other side to finish, it'll get sent SIGHUP. Bug: http://b/27414382 Change-Id: I93514d2242ed0d7aa93a6ec6836270dc0783506d
| * adb: wait for adbd to die and respawn in root/unroot.Josh Gao2016-03-043-4/+60
| | | | | | | | | | Bug: http://b/19749057 Change-Id: I57dbc113803b6fd3016c1801410be0f4023245d9
| * adb: make ScopedFd universally accessible and useful.Josh Gao2016-03-043-33/+44
| | | | | | | | Change-Id: I707ffbd10958e7449b4c95dff48638480c746939
* | adbd: fix spurious close of uninitialized fd.Josh Gao2016-03-041-1/+3
|/ | | | | | | | forkpty only returns an fd on the master side; trying to keep track of it on both sides is incorrect. Bug: http://b/27504427 Change-Id: Ia4a454d8490c77738f9c3350a4236b3d99c8758b
* Merge changes I7fe77245,I75b089b8,Iafa250ceJosh Gao2016-03-032-48/+83
|\ | | | | | | | | | | | | * changes: adb: clean up quotes in test_device.py. adb: mkdir the correct directory name when pulling. adb: cleanup file skipping logic.
| * adb: clean up quotes in test_device.py.Josh Gao2016-03-031-13/+13
| | | | | | | | Change-Id: I7fe7724578ad89a004665d1bbff0d5c02c34c35e
| * adb: mkdir the correct directory name when pulling.Josh Gao2016-03-032-1/+25
| | | | | | | | | | | | | | The directory name should be based off of the local path, not the remote path. Change-Id: I75b089b8734e9dbf8e466b1e00ea18549fd101bb
| * adb: cleanup file skipping logic.Josh Gao2016-03-031-34/+45
| | | | | | | | | | Bug: http://b/26355212 Change-Id: Iafa250ce6c5ea8da9f5f00125165e5b67ef1013f
* | Merge "adb: relax serial matching rules."David Pursell2016-03-036-34/+199
|\ \ | |/ |/|
| * adb: relax serial matching rules.David Pursell2016-03-026-34/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently targeting a device by serial requires matching the serial number exactly. This CL relaxes the matching rules for local transports to ignore protocol prefixes and make the port optional: [tcp:|udp:]<hostname>[:port] The purpose of this is to allow a user to set ANDROID_SERIAL to something like "tcp:100.100.100.100" and have it work for both fastboot and adb (assuming the device comes up at 100.100.100.100 in both modes). This CL also adds some unit tests for the modified functions to make sure they work as expected. Bug: 27340240 Change-Id: I006e0c70c84331ab44d05d0a0f462d06592eb879
* | Merge "adb: symlinks to dirs count as dirs for pull destination."Josh Gao2016-03-032-1/+69
|\ \ | |/ |/|
| * adb: symlinks to dirs count as dirs for pull destination.Josh Gao2016-03-022-1/+69
| | | | | | | | | | | | | | | | This matches scp's behavior when pulling a directory that collides with a symlink to a directory. Bug: http://b/27362811 Change-Id: I0936d1ad48f13e24cd382e8e8400cc752bac3b66
* | Merge "Emulator: fix adbd qemu pipe partial write"Bo Hu2016-03-021-6/+6
|\ \
| * | Emulator: fix adbd qemu pipe partial writebohu2016-03-011-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It does happens that the adb_write only writes to the qemu pipe partially which throws host side's adb backend into confusion and crashes. This CL replaces adb_write with WriteFdExactly; adb_read with ReadFdExactly. Change-Id: I10424ad730c73516d16b0eb7318e8c9beea9b36b
* | | adb: report progress for small files.Josh Gao2016-03-011-0/+1
| | | | | | | | | | | | | | | Bug: http://b/27407725 Change-Id: I7515144402a487fb3d4d403e2f5f82423c1b5ed6
* | | Also archive adb.exe/fastboot.exe when building win_sdk.Ying Wang2016-02-291-1/+5
|/ / | | | | | | | | | | | | On linux we archive both Linux and Windows binaries. Bug: 27315911 Change-Id: I17d25cd1ea611a9c917f1e78b47f21a8959eea20
* | Merge "adb: use TCP keepalive."David Pursell2016-02-295-0/+97
|\ \
| * | adb: use TCP keepalive.David Pursell2016-02-235-0/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently adb only realizes a TCP transport has gone away when it tries to send a packet, which caused problems in particular for `adb reboot` since no packets are sent, leading to the client hanging until Ctrl+C. This CL turns on TCP keepalive packets to send 1 packet every second, allowing up to 10 failures before disconnecting. Using built-in TCP functionality turns out to be much cleaner in this case than trying to implement our own keepalive packets at the application layer, and should be more lightweight since it's all done in the TCP stack. Bug: http://b/23093474 Change-Id: Ifb41cbb85b9752a9f394e1eed3c6ac4da47a4e4d
* | | Merge "adb: fix directory creation logic."Josh Gao2016-02-271-21/+6
|\ \ \ | | |/ | |/|
| * | adb: fix directory creation logic.Josh Gao2016-02-261-21/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, for `adb pull $remote $local`, we would do the equivalent of mkdir -p on `dirname $local`. This patch changes the behavior to only creating directories that are being pulled, like scp. Bug: http://b/27362811 Change-Id: I79f975ee9f2d9bc9e8be6a7c4f2de6d7ae2d2d23
* | | adb: fix mistaken use of PLOG.Josh Gao2016-02-251-1/+1
|/ / | | | | | | Change-Id: I60bfa3d8cf1572a877d6f0c9369d8f72f10e5aef