History log of /system/core/adb/adb.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
eec5e52ea24a9b86a9cee75c1e3207e9378b41c8 06-Oct-2016 Lingfeng Yang <lfy@google.com> Fix adb flakiness on reboot

bug: 31950237

There are two lists of active ADB transports (devices),
and with the emulator, they can go out of sync.

This CL more conservatively checks if there are no
transports in either list before commiting to
register a new transport for the emulator.

Change-Id: Id1201dc59c70825881dad80925c2e5bcc13dbd5e
(cherry picked from commit edaedfd5da41b2f5aa14b4d52742a6d8caa49214)
/system/core/adb/adb.h
78e0963e4bce9cc9f0bbf0b686004ba15b1e3929 20-Jul-2016 Felipe Leme <felipeal@google.com> Split bugreport() into its own file and added unit tests.

bugreport() will be soon refactored to track progress, which will
require more comprehensive unit tests.

As such, it's better to move it to its own files, which in turn also
requires moving send_shell_command() and usage() to commandline.h.

Fixes: 30100363
Bug: 30268737

Change-Id: I3cdf114a0b5547293320042ff0749a60886440b0
/system/core/adb/adb.h
988e9bc1f80230c99f7b171b6669cdec77c62396 15-Apr-2016 Josh Gao <jmgao@google.com> adb: bump the server version to 36.

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
(cherry picked from commit 057095d2076dfe571fb2a3c6904f77282aaeacaa)
/system/core/adb/adb.h
56e9bb9bd6861c7e5c60a5d304966f39c44b6c23 16-Jan-2016 Josh Gao <jmgao@google.com> adb: tag fatal, fatal_errno with printf attribute.

Also, fix bugs that this uncovered. In particular, the sysdeps_win32
FATAL macro would only print __FUNCTION__.

Change-Id: I6307ec9749edec21b4fee192e135a86ec445c84b
/system/core/adb/adb.h
1b708d368f29e6053064c9cf6949ab6ebdbb7ac5 12-Dec-2015 Elliott Hughes <enh@google.com> Share the new adb USB diagnostic code with fastboot.

Bug: http://b/26134129
Change-Id: Ieaf0651c7b3f8a028760982091ec63a21a5484ba
/system/core/adb/adb.h
663e949b2bbda5dcc2b92e4d1936555019cdd66b 08-Dec-2015 David Pursell <dpursell@google.com> Merge "adb: add help text for USB permission errors."
4f71319df011d796a60a43fc1bc68e16fbf7d321 05-Dec-2015 Elliott Hughes <enh@google.com> Track rename of base/ to android-base/.

Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
/system/core/adb/adb.h
d2acbd19312a66cbee2c49f455eddd82b6700d1d 03-Dec-2015 David Pursell <dpursell@google.com> adb: add help text for USB permission errors.

The current permission messages can be confusing for users who don't
know about udev and USB access permissions. This CL adds some checks to
try to identify common udev problems, and adds a link to online
documentation.

Example messages:

1) adb server is in plugdev group but access is still denied:
$ adb devices
List of devices attached
082f59270073e1e3 no permissions (verify udev rules); see [developer.android.com/tools/device.html]

2) plugdev group exists but adb server is not in it:
$ adb shell
error: USB permission failure: udev requires plugdev group membership.
See [developer.android.com/tools/device.html] for more information.

3) plugdev group does not exist:
$ adb shell
error: USB permission failure.
See [developer.android.com/tools/device.html] for more information.

Bug: http://b/25777880
Change-Id: I536565adc12ab657c75151309795674181205db0
/system/core/adb/adb.h
65433da1cbd8d2869a60ce3bf18b6b440461741d 19-Nov-2015 Elliott Hughes <enh@google.com> Avoid SIGPIPE in adb.

We're now able to send packets faster than the device can handle them,
meaning that sometimes we're several packets through before the device
says "hey, wait, I can't write" and closes the connection. At best this
led to us reporting that we couldn't sync because "Connection reset";
at worst we'd get SIGPIPE because we were still streaming to a connection
that had already been closed.

This change renames adb_main adb_server_main, and moves the ignoring of
SIGPIPE into adb_commandline so it applies to both client and server (but
not adbd).

This change doesn't address the "wrong error message" part of the problem,
but at least it means you'll get *an* error message.

Bug: http://b/25230872
Change-Id: Ic60e4d13ed03fdcdf0d5cbc97201ebd1097c16ed
/system/core/adb/adb.h
6fa848adbab275c76d590a133290a59a6ef9a4d5 04-Nov-2015 Todd Kennedy <toddke@google.com> use new cmd command

Instead of using the pm command, 'adb install' and 'adb uninstall' will now
use the cmd command. Additionally, the APK will be streamed directly to
package installer instead of creating a temporary file.

(cherry-pick of d039800a4e008b52c532f901e3bb34b40877cf30.)
Change-Id: Ie7529afa5b039d29cc8183f36085ff4e66b3457a
/system/core/adb/adb.h
70ef7b40f96e44ebb86f4eb23ccfa1a9230cdb65 30-Sep-2015 David Pursell <dpursell@google.com> adb: put legacy shell: service back in.

ddmlib does not use the ADB client, but instead connects directly to
the adb server. This breaks some of the assumptions I previously made
when enabling the shell protocol.

To fix this, the adb server now defaults to no protocol for the
standalone command, and the shell protocol must be explicitly requested
by the client. For example:
shell:echo foo -- no shell protocol
shell,v2:echo foo -- shell protocol

As long as I was touching the shell service arguments I also changed
them to no longer duplicate the command-line arguments. This allows
more flexibility to change the adb client CLI if necessary and makes
the code more readable.

Bug: http://b/24148636
Change-Id: I28d5ae578cf18cbe79347dc89cea1750ff4571a8
/system/core/adb/adb.h
bbe3d210ba9776f2e72f17c6213438890e1a8683 25-Sep-2015 David Pursell <dpursell@google.com> adb: bump server version to prevent feature mismatch.

Devices get a list of supported features from the adb server, not the
client, so a mismatch between client and server features can cause the
device to use an incorrect feature set.

Bumping the server version is the easiest way to make sure the client
and server features match and seems like the best solution at the
moment.

A more automated fix could be to compare client/server features on each
connection and restart if they don't match. This requires an extra
client <-> server round-trip per command, but removes the need to
manually bump the server version number on feature change. Unless the
feature set changes often it didn't seem worth the extra overhead.

Bug: http://b/24370690
Change-Id: I4e43825d1c15c61e5d924fc8d4110b467debde37
/system/core/adb/adb.h
c1b1f6ff5de82b457923eea3f0bbad1ac2e459d7 16-Sep-2015 Yabin Cui <yabinc@google.com> Add unit tests for local socket.

Add has_write_error flag in asocket, so it will not wait on local_socket_closing_list
to write pending packets in local_socket_close(). Although it doesn't fix any problem,
it helps to make the code more stable.
Add a missing put_apacket() in error handling.
Add a check when adding local socket in local_socket_closing_list.

Bug: 23314034

Change-Id: I75b07ba8ee59b7f277fba2fb919db63065b291be
/system/core/adb/adb.h
0955c66b226db7a7f34613f834f7b0a145fd407d 31-Aug-2015 David Pursell <dpursell@google.com> adb: implement shell protocol.

Adds functionality for handling stdin/stdout/stderr streams and exit
codes using the shell protocol.

This CL just contains implementation for adbd which will not yet be
enabled. Once we have the ability to query transport features from the
adb client, another CL will add the implementation for the client side
and update the feature list to turn this on.

Note: this CL must be submitted together with a minadbd CL to update
the service_to_fd() function signature.

Bug: http://b/23030641

Change-Id: Ibed55e9c1946d8a35190696163ff63e8fb880238
/system/core/adb/adb.h
9f07f87908f072d63d8bb9ded91616af8d3edbb4 29-Aug-2015 Elliott Hughes <enh@google.com> Merge "fatal and fatal_errno should be noreturn."
2f3342fa33a39df1ef0f5f94dfeca7687e16a346 29-Aug-2015 Elliott Hughes <enh@google.com> fatal and fatal_errno should be noreturn.

Change-Id: I9c5d9cb5ed743d13e65112a111cc9544ec5da339
/system/core/adb/adb.h
b329824e6c5373ae303269dca285d835ce57e514 29-Aug-2015 Yabin Cui <yabinc@google.com> adb: clean up transport disconnect operations.

Move operations from global functions into member functions.
Add unit test.

Change-Id: Id4543d8e78541eb08c8e629f180c605c699737ec
/system/core/adb/adb.h
1792c23cb892ab58590b2cdfce0d0ece30c21787 18-May-2015 Dan Albert <danalbert@google.com> Add feature list to connection banner.

This allows us to test for features explicitly rather than relying on
the protocol version number, allowing us to fall back gracefully if a
feature is not supported.

This will be needed for the upcoming shell upgrades for stdout/stderr
separation and exit code reporting.

Change-Id: Ibb1d8ad2611f7209901ee76d51346b453e9c5873
/system/core/adb/adb.h
317acfb88065f68bc3030a5624a63ba4cfaab414 12-Aug-2015 Yabin Cui <yabinc@google.com> Merge "Remove confusing variable HOST."
42ae2604f43ef88be748f125e8733f2c08b83fae 12-Aug-2015 Elliott Hughes <enh@google.com> Always include the adb version in the log.

"Are you running the right version?" seems to be a common cause of debugging
confusion.

Change-Id: I4a4ba95e876dafc05e515058ca059ea370273f78
/system/core/adb/adb.h
661327e8e40f95076e0e8abe86193da16b061bd8 11-Aug-2015 Yabin Cui <yabinc@google.com> Remove confusing variable HOST.

First, HOST is always 0 in adbd, which matches ADB_HOST=0.
Second, HOST is always 1 when adb_main is called, which matches ADB_HOST=1.
For adb client that doesn't call adb_main, it never touches local_init(),
init_transport_registration() and fdevent_loop(). So the changes in adb.cpp,
services.cpp and transport_local.cpp do nothing with it.
As a conclusion, I think we can remove HOST and use ADB_HOST instead.

Change-Id: Ide0e0eca7468b6c3c130f6b50974406280678b2e
/system/core/adb/adb.h
9f2d1a9cfc04e1d5970823da1878097288a9a9cd 07-Aug-2015 Siva Velusamy <vsiva@google.com> adb start-server: Use a separate fd for sending initial OK

When "adb start-server" is issued, and a server needs to be launched,
adb client forks itself and the child process runs the server routine.
Once the server initializes its various components, it sends an "OK\n"
back to the client via its stderror (or stdout on Windows).

This sequence breaks down if before sending the "OK\n", the server
happens to log something on its stderr. In order to avoid this, the
client now expects the ack to come on a different fd rather than one
of the standard streams.

Bug: https://code.google.com/p/android/issues/detail?id=182150

Change-Id: I9d58a08068d71eb3b77e8a7377e934631c016466
/system/core/adb/adb.h
381cfa9a8bc262dcd823a8bb6adc189595a2fe7d 24-Jul-2015 Elliott Hughes <enh@google.com> Report getaddrinfo failures correctly.

Also move us off the "convenience" function because you can't get useful
error reporting from it.

Change-Id: I5fcc6a6d762f5f60906980a7835f01a35045be65
/system/core/adb/adb.h
3d2904cdf2371e26c0465184436bd063979a5d97 13-Jul-2015 Tamas Berghammer <tberghammer@google.com> Increase size of the the adb packets sent over the wire

The reason behing this change is to increase the adb push/pull speed
with reduceing the number of packets sent between the host and the
device because the communication is heavily bound by packet latency.

The change maintains two way compatibility in the communication
protocol with negotiating a packet size between the target and the
host with the CONNECT packets.

After this change the push/pull speeds improved significantly
(measured from Linux-x86_64 with 100MB of data):

| Old push | Old pull || New push | New pull |
-----------------------------------------------------------
Hammerhead | 4.6 MB/s | 3.9 MB/s || 13.1 MB/s | 16.5 MB/s |
-----------------------------------------------------------
Volantis | 6.0 MB/s | 6.2 MS/s || 25.9 MB/s | 29.0 MB/s |
-----------------------------------------------------------
Fugu | 6.0 MB/s | 5.1 MB/s || 27.9 MB/s | 33.2 MB/s |
-----------------------------------------------------------

Change-Id: Id9625de31266e43394289e325c7e7e473379c5d8
/system/core/adb/adb.h
947cb3e8eeb5583654ceac95e97762f20ff62035 17-Jul-2015 Alex Vallée <avallee@chromium.org> Remove subproc events when ADB_HOST.

The code which triggers these events (via the SHELL_EXIT_NOTIFY_FD) are
only called from code which is already guarded by #if !ADB_HOST.

Change-Id: I184414f5e090c1f08ee117e4c8c434cd4a8b5221
/system/core/adb/adb.h
286bb6ddbd52584af0c6c76fbe0498f3dea4b944 09-Jul-2015 Dan Albert <danalbert@google.com> Revert "Turn on -Wformat-nonliteral."

One of my build aliases doesn't play nice with USE_MINGW=1, so my build lied to me. Will revert until I fix it up.

This reverts commit 459df8f3a14d4c614f0211049800cf7cad6d30ad.

Change-Id: I7905c5ae5ee85fb2d228ce63d81c79f140998c18
/system/core/adb/adb.h
459df8f3a14d4c614f0211049800cf7cad6d30ad 08-Jul-2015 Dan Albert <danalbert@google.com> Turn on -Wformat-nonliteral.

Apparently there are two classes of this warning in clang.
-Wformat-security is only emitted for cases of
`func(nonliteral_fmt_string)` (no args), and -Wformat-nonliteral is
emitted for cases *with* arguments. For whatever reason, the latter
isn't included in -Wextra and must be manually enabled.

To make this more easily portable to Windows, move the existing
gnu_printf/__printf__ decision into base/macros.h as ATTRIBUTE_FORMAT.

Change-Id: I3b0990e1d1f0a2e9c13b32f5cd60478946cb5fc6
/system/core/adb/adb.h
c7915a3470292349017f94ca066ed515babfcc23 19-May-2015 Dan Albert <danalbert@google.com> Make atransport be a real class.

Using non-POD types in atransport means we'll need to start treating
it as a real class (specifically with regards to new/delete rather
than malloc/free).

I've also cleaned up the home grown linked lists for transport_list
and pending_list to just be std::lists. We might want to refactor that
again to be an std::unordered_map keyed on serial, since that seems to
be a common way to search it.

Change-Id: I7f5e23cdc47944a9278099723ca029585fe52105
/system/core/adb/adb.h
dcd78a15d0be143d48fc93af6a9fa5748dbf9790 19-May-2015 Dan Albert <danalbert@google.com> Make connection states a proper type.

Change-Id: I809f9b327c832b88dd63151bf7dcb012d88e81c4
/system/core/adb/adb.h
c89e0ccd40624e8b2ce30d425e8bed0264fae548 09-May-2015 Dan Albert <danalbert@google.com> Revert "Revert "Split adb_main.cpp into client and daemon.""

This reverts commit 218dbccefa3d874d988e4784bda5e45b7643cb5a.

Change-Id: I74088db34983dc99e316a07c6ddc294340e0eb71
/system/core/adb/adb.h
218dbccefa3d874d988e4784bda5e45b7643cb5a 09-May-2015 Dan Albert <danalbert@google.com> Revert "Split adb_main.cpp into client and daemon."

This reverts commit cf07494ac2a101c3afbe23a7d85121553f586cf7.
/system/core/adb/adb.h
cf07494ac2a101c3afbe23a7d85121553f586cf7 06-May-2015 Dan Albert <danalbert@google.com> Split adb_main.cpp into client and daemon.

The name "client" is somewhat misleading as it also contains the host
side adb server, but it's a part of the client binary.

Change-Id: I128b7bab213e330eb21b5010cd1fec5f7a62c8af
/system/core/adb/adb.h
aee80fb67bcc3fc5209050c40bd8efc1bbcc0610 08-May-2015 Elliott Hughes <enh@google.com> Add some missing 'const's.

Change-Id: I5bd26d4366e10fc8c6bc255b7ddb174a7a8b82a5
/system/core/adb/adb.h
3bd73c12c07dcefc965abeef535ac53c4754d682 05-May-2015 Elliott Hughes <enh@google.com> Give enum types CamelCase names for clarity.

Change-Id: I1c89f1cc155ee839f372fb14d972a288183b8bcd
/system/core/adb/adb.h
e67f1f87d9b1188ec8617035db7006c37ee7b21e 01-May-2015 Elliott Hughes <enh@google.com> More adb buffer fixes.

This patch factors out a lot of the basic protocol code: sending OKAY,
sending FAIL, and sending a length-prefixed string.

ADB_TRACE has been non-optional for a long time, so let's just remove
the #ifs.

Also actually build the device tracker test tool (and remove its duplicate).

Bug: http://b/20666660
Change-Id: I6c7d59f18707bdc62ca69dea45547617f9f31fc6
/system/core/adb/adb.h
6452a89aa8934231e12ab77e0d90f12c3e892ad1 29-Apr-2015 Elliott Hughes <enh@google.com> More fixed-length buffer removal.

Bug: http://b/20666660
Change-Id: I0c738e9fed2defed48a9cf2d0a4f7b99c08dcf3d
/system/core/adb/adb.h
2d4121c0dcc93382bcd7ea6476f433d8254919dd 17-Apr-2015 Elliott Hughes <enh@google.com> Remove extern "C" barriers to using C++.

Change-Id: Ic046d6aa540738cb46b54531bc59ba3b47b0136d
/system/core/adb/adb.h
ec7a66713144a16361724fe88332b28bbf3f4b3c 16-Mar-2015 Elliott Hughes <enh@google.com> Revert "Revert "adb: support /oem partition""

This reverts commit 6084a0124f868c7ec43f6c415a27a168f27ff694.

The original build breakage is fixed by (a) building the verity
code for eng builds as well as userdebug builds and (b) moving
the exported remount service functions into a new header file.

Change-Id: Ice0c4f97d4db38ab7eb333c7a6e56bbd11123f5b
/system/core/adb/adb.h
bac3474a8256cb32a29e8d46f78cad95a5502692 26-Feb-2015 Dan Albert <danalbert@google.com> Move adb to C++.

I keep trying to clean things up and needing std::strings. Might as
well just do this now.

usb_linux_client.c is going to stay as C because GCC isn't smart
enough to deal with the designated initializers it uses (though for
some reason it is in C mode).

The Darwin files are staying as C because I don't have a way to test
that they build.

The Windows files are staying as C because while I can actually build
for them, it's slow and painful.

Change-Id: I75367d29205a9049d34460032b3bb36384f43941
/system/core/adb/adb.h
7664901a355b959f312e9acff5a0fd31b7139623 25-Feb-2015 Dan Albert <danalbert@google.com> Move transport declarations into transport.h.

There are a few cloexec issues in here as an added bonus.

Change-Id: I1699d719d733f47878bdba0454230cf5ab6a60b6
/system/core/adb/adb.h
bd0b750897bebaa10e16507fdd08dbc746cd228d 19-Feb-2015 Dan Albert <danalbert@google.com> Move adb_main to its own file.

Change-Id: If6e98c089b39f73bd8f4a878a82669bfeee367f3
/system/core/adb/adb.h
ba3a251749c88210949008ae26f8bc04812084c1 19-Feb-2015 Dan Albert <danalbert@google.com> Move the adb auth code into its own file.

Change-Id: I84cf0bd7777f0147119e7c6afc4096c2e93156a2
/system/core/adb/adb.h
818fb4b448a44ef9f1db85f66415fde4b7a96aa6 18-Feb-2015 Dan Albert <danalbert@google.com> Add extern "C" to all the adb headers.

Change-Id: Iaefa3e18d6ee2e065eb97271a796613b2a8e7d6e
/system/core/adb/adb.h
630b9afeb0d7f0e5e053db0f900cfb65d914cb1a 25-Nov-2014 Dan Albert <danalbert@google.com> Begin moving code from adb to libadb.

Much of adb is duplicated in bootable/recovery/minadb and fastboot.
Changes made to adb rarely get ported to the other two, so the trees
have diverged a bit. We'd like to stop this because it is a
maintenance nightmare, but the divergence makes this difficult to do
all at once. For now, we will start small by moving common files into
a static library. Hopefully some day we can get enough of adb in here
that we no longer need minadb.

Bug: 17626262
Change-Id: Ic8d5653bfcc0fec4e1acbece124402355084b864
/system/core/adb/adb.h
13449cd71464c3a644109c469a77bd7fd56c8af8 02-Jan-2015 Sami Tolvanen <samitolvanen@google.com> Fix disable-verity when the underlying block device is RO

If verity is enabled and the underlying block device is marked
read-only, disable-verity fails. We cannot use the existing code
for enable-verity to make the device writable as the device in
/proc/mounts will be the verity device instead of the underlying
device we want to change. This change makes the correct device
writable when altering verity state.

Change-Id: I423ee50fb34d78cff2fe843318b9081c03c5142d
/system/core/adb/adb.h
982089d83879c768eac3fd36f19665463a550b53 04-Dec-2014 Paul Lawrence <paullawrence@google.com> Add adb enable-verity

Note that it is *easy* to break your phone with this feature. It is
not a bug that reenabling verity after changing one byte of the system
partition stops the device booting.

(cherry-pick of 7c442e1700e6312727283db402dec6f666f1b55a.)

Bug: 18529433
Change-Id: I632e91281884471a362960f1ba30312d2669b8ff
/system/core/adb/adb.h
ec900bba20630934dc51a1b3a57d6d7a30fed325 09-Oct-2014 Paul Lawrence <paullawrence@google.com> Revert "Revert "Enable verity on userdebug, and add disable-verity to adb""

This reverts commit 152d2d4234ba89e0c20c4af13e291b6049a7bc33.

Fixed build error, and also fixed memory leak spotted from warning.

(cherry-pick of bbb36319119edde9377fb80015235893c30d2bc9.)

Bug: 17691572
Change-Id: I23b5ba537f7b557432041d4338b38b9be434e981
/system/core/adb/adb.h
cbf0267f5b508f6933631e661a5be86f0bd89ed1 15-Aug-2014 leozwang <leozwang@google.com> Add more debug information.

Re-commit https://googleplex-android-review.googlesource.com/#/c/519430/
Add fix for win_sdk build.

Add socketpair debug log.
Also output thread information in log on host side.

(cherry-pick of adb09fa01a16d8c5c92c2f8d325e1678c531223f.)

Change-Id: I21021bc111a3f7362a91b70593e3738125878118
/system/core/adb/adb.h
97ac0e1bb42ddd17c75691ecbe1df8a6520d4c81 22-Nov-2014 Elliott Hughes <enh@google.com> Kill HAVE_BIG_ENDIAN, HAVE_ENDIAN_H, and HAVE_LITTLE_ENDIAN.

Change-Id: I9e25ac9d27e95b04fb8bf7a66c619af0139d8b8f
/system/core/adb/adb.h
d3fc15f4841a8cbfd15fa9f051f2712266b5cd78 29-Jul-2014 leozwang <leozwang@google.com> Consolidate adb trace macro defines into its own header file.

Most code is copied and pasted from adb.h.
Any file can just include it to enable tracing.
Removed some duplications.

Change-Id: Ie1ed9e9edbf92158aac84669fbcbf7dc85fe2cf0
/system/core/adb/adb.h
48a904240bf32fcba701ad8634651569a586d0aa 24-Jul-2014 leozwang <leozwang@google.com> Redirect debug output to logcat.

If ADB_TRACE is enabled, debug output will be redirected to logcat.

Change-Id: I9c36ada7690a2b946ecd6a926d04e36a8313c36a
/system/core/adb/adb.h
71fe584a1a7256c057267ae46a35f7c74d1d549e 27-Jun-2014 Doug Zongker <dougz@google.com> add sideload-host mode to adb

The sideload-host mode turns the host into a server capable of sending
the device various pieces of the file on request, rather than
downloading it all in one transfer. It's used to support sideloading
OTA packages to devices without the need for them to hold the whole
package in RAM.

If the connected device doesn't support sideload-host mode, we fall
back to the older sideload connection.

Change-Id: I5adaedd8243dc3b76414bba0149879ca2bbf35fa
/system/core/adb/adb.h
b81708146f51afb434739374095161ab7ff32787 02-Jun-2014 Jeff Sharkey <jsharkey@android.com> Merge "Add "exec" service: shell commands with no pty."
5d9d434efadf1c535c7fea634d5306e18c68ef1f 27-May-2014 Jeff Sharkey <jsharkey@android.com> Add "exec" service: shell commands with no pty.

To facilitate device scripts that want to read/write binary data from
the host side, this change introduces a new "exec" service that
behaves like "shell" but without creating a pty, which would otherwise
mangle binary data.

After forking, it hooks up stdin/stdout of the child process to
the socket connected through to the host. The adb transport doesn't
support shutdown(), so the host can't half-close the socket and wait
for device termination. Instead, the host side now has two explicit
commands "exec-in" and "exec-out" for either sending or receiving
data.

Teach host side copy_to_file() to deal with stdin/stdout special
cases. Switch device side backup/restore services to use the new
create_subproc_raw under the hood.

Change-Id: I5993049803519d3959761f2363037b02c50920ee
/system/core/adb/adb.h
252586941934d23073a8d167ec240b221062505f 21-Mar-2013 David 'Digit' Turner <digit@android.com> adb: implement "adb reverse <local> <remote>"

This implements the logical opposite of 'adb forward', i.e.
the ability to reverse network connections from the device
to the host.

This feature is very useful for testing various programs
running on an Android device without root or poking at the
host's routing table.

Options and parameters are exactly the same as those for
'adb forward', except that the direction is reversed.

Examples:

adb reverse tcp:5000 tcp:6000
connections to localhost:5000 on the device will be
forwarded to localhost:6000 on the host.

adb reverse --no-rebind tcp:5000 tcp:6000
same as above, but fails if the socket is already
bound through a previous 'adb reverse tcp:5000 ...'
command.

adb reverse --list
list all active reversed connections for the target
device. Note: there is no command to list all
reversed connections for all devices at once.

adb reverse --remove tcp:5000
remove any reversed connection on the device from
localhost:5000

adb reverse --remove-all
remove all reversed connections form the current
device.

Reversed connections are tied to a transport, in other
words, they disappear as soon as a device is disconnected.

Simple testing protocol:

adb forward tcp:5000 tcp:6000
adb reverse tcp:6000 tcp:7000
nc -l localhost 7000

in another terminal:
echo "Hello" | nc localhost 5000

Will print "Hello" on the first terminal.

Change-Id: I761af790cdb06829b68430afa4145a919fa0e6d5
/system/core/adb/adb.h
7aa39a7b199bb9803d3fd47246ee9530b4a96177 10-Dec-2013 Mark Salyzyn <salyzyn@google.com> adb: deprecate legacy log service interface

(cherry picked form commit c66a7537df987715acc77eed952111cc56b7e72b)

Change-Id: If96019cc13b3d7a4dcd7785c7137e0cbcc622981
/system/core/adb/adb.h
39ea00bf9dca98c655c27d8159278fb226351984 19-Dec-2013 Nick Kralevich <nnk@google.com> am 4639ae45: am a0ce4e28: am 98fdcfa9: am 67cb61ee: Merge "adb: Check sender\'s socket id when receiving packets."

* commit '4639ae452e7d22343053c5127ecb44ef19b7baf2':
adb: Check sender's socket id when receiving packets.
818d641c420f5d4f35f4e8706937c17b974146d1 13-Dec-2013 David 'Digit' Turner <digit@android.com> adb: Check sender's socket id when receiving packets.

handle_packet() in adb.c didn't check that when an A_WRTE packet is
received, the sender's local-id matches the socket's peer id.

This meant that a compromised adbd server could sent packets to
the host adb server, spoofing the identity of another connected
device if it could "guess" the right host socket id.

This patch gets rid of the issue by enforcing even more checks
to ensure that all packets comply with the description in
protocol.txt.

+ Fix a bug where closing a local socket associated with a
remote one would always send an A_CLSE(0, remote-id, "")
message, though protocol.txt says that should only happen
for failed opens.

The issue was that local_socket_close() called
remote_socket_close() after clearing the remote socket's
'peer' field.

The fix introduces a new asocket optional callback,
named 'shutdown' that is called before that, and is
used to send the A_CLSE() message with the right ID
in remote_socket_shutdown().

Also add some code in handle_packet() to detect
invalid close commands.

Change-Id: I9098bc8c6e81f8809334b060e5dca4fc92e6fbc9
/system/core/adb/adb.h
c66a7537df987715acc77eed952111cc56b7e72b 10-Dec-2013 Mark Salyzyn <salyzyn@google.com> adb: deprecate legacy log service interface

Change-Id: If96019cc13b3d7a4dcd7785c7137e0cbcc622981
/system/core/adb/adb.h
1c45ee92e2372f3c552744823143fb093fdbda9d 30-Mar-2013 Benoit Goby <benoit@android.com> adb: Handle adb connect in a thread

adb connect calls connect() in the event loop. If you pass a wrong ip
address or the server is slow to respond, this will block the event loop
and you can't even kill the adb server with adb kill-server. Handle connect
requests in a service thread instead.

Change-Id: I2ee732869a3dc22a6d3b87cf8ac80acaa7790037
/system/core/adb/adb.h
9470c2f1ab555311633d52e5ed8303a813061cdf 21-Feb-2013 Benoit Goby <benoit@android.com> adb: Cleanup dead code

dns_service is unused and recover_service has been replaced by adb
sideload

Change-Id: Ie90000d7f672e8299ee1622a9690c7371b214dc1
/system/core/adb/adb.h
77e8e5851d3b951b5382663bd50f1f83cb531eb2 15-Jan-2013 Benoit Goby <benoit@android.com> adb: Add "unauthorized" connection state

Add a new connection state, so that devices, that require confirmation
to allow adb, appear as "unauthorized" in the adb devices lists.

Change-Id: Ib4264bc5736dedecf05bcf8e31896f4d7a91fad8
/system/core/adb/adb.h
64b3103017cb9038c5fb7e3601f51c6a458bed06 31-Aug-2012 Benoit Goby <benoit@android.com> adb: Create private key with 0600 mode

Changed key name to force generating new pairs.

Bug: 7092477
Change-Id: I680cb9dd1896ae52b2b29d63533f966e033d823f
/system/core/adb/adb.h
d5fcafaf41f8ec90986c813f75ec78402096af2d 12-Apr-2012 Benoit Goby <benoit@android.com> adb: Add public key authentification

Secure adb using a public key authentication, to allow USB debugging
only from authorized hosts.

When a device is connected to an unauthorized host, the adb daemon sends
the user public key to the device. A popup is shown to ask the user to
allow debugging once or permanantly from the host. The public key is
installed on the device in the later case. Other keys may be installed
at build time.

On the host, the user public/private key pair is automatically generated,
if it does not exist, when the adb daemon starts and is stored in
$HOME/.android/adb_key(.pub) or in $ANDROID_SDK_HOME on windows. If needed,
the ADB_KEYS_PATH env variable may be set to a :-separated (; under
Windows) list of private keys, e.g. company-wide or vendor keys.

On the device, vendors public keys are installed at build time in
/adb_keys. User-installed keys are stored in /data/misc/adb/adb_keys.

ADB Protocol change:
If the device needs to authenticate the host, it replies to CNXN
packets with an AUTH packet. The AUTH packet payload is a random token.
The host signs the token with one of its private keys and sends an AUTH(0)
packet. If the signature verification succeeds, the device replies with
a CNXN packet. Otherwise, it sends a new AUTH packet with a new token so
that the host can retry with another private key. Once the host has tried
all its keys, it can send an AUTH(1) packet with a public key as
payload. adbd then sends the public key to the framework (if it has been
started) for confirmation.

Change-Id: I4e84d7621da956f66ff657245901bdaefead8395
/system/core/adb/adb.h
3fc95a991805feba257a396c13548776fd36f34f 21-Aug-2012 Benoit Goby <benoit@android.com> Revert "adb: Add public key authentification"

This reverts commit f4ed516643ee8ed3a59ad1a8048f7ce5f47f93fb.
/system/core/adb/adb.h
f4ed516643ee8ed3a59ad1a8048f7ce5f47f93fb 12-Apr-2012 Benoit Goby <benoit@android.com> adb: Add public key authentification

Secure adb using a public key authentication, to allow USB debugging
only from authorized hosts.

When a device is connected to an unauthorized host, the adb daemon sends
the user public key to the device. A popup is shown to ask the user to
allow debugging once or permanantly from the host. The public key is
installed on the device in the later case. Other keys may be installed
at build time.

On the host, the user public/private key pair is automatically generated,
if it does not exist, when the adb daemon starts and is stored in
$HOME/.android/adb_key(.pub) or in $ANDROID_SDK_HOME on windows. If needed,
the ADB_KEYS_PATH env variable may be set to a ;-separated list of private
keys, e.g. company-wide or vendor keys.

On the device, vendors public keys are installed at build time in
/adb_keys. User-installed keys are stored in /data/misc/adb/adb_keys.

ADB Protocol change:
If the device needs to authenticate the host, it replies to CNXN
packets with an AUTH packet. The AUTH packet payload is a random token.
The host signs the token with one of its private keys and sends an AUTH(0)
packet. If the signature verification succeeds, the device replies with
a CNXN packet. Otherwise, it sends a new AUTH packet with a new token so
that the host can retry with another private key. Once the host has tried
all its keys, it can send an AUTH(1) packet with a public key as
payload. adbd then sends the public key to the framework (if it has been
started) for confirmation.

Change-Id: Idce931a7bfe4ce878428eaa47838e5184ac6073f
/system/core/adb/adb.h
c29569c5d3c1358983915596267e85e85c7f82e2 07-Jun-2012 Benoit Goby <benoitgoby@google.com> Merge "FunctionFS: initial implementation"
0e9e13eb46d8ffbb456f937db4a8fb0da02dd5d2 06-Jun-2012 Scott Anderson <saa@android.com> am 2ca3e6b3: adb: Generalizing -s to take qualifiers.

* commit '2ca3e6b35f79136418ebc32fef57580698dbd045':
adb: Generalizing -s to take qualifiers.
3fef581bc7a513defe48329973d14bec722f1293 06-Jun-2012 Scott Anderson <saa@android.com> am e82c2db0: adb: Transmit key properties in banner of connect message

* commit 'e82c2db05cae70a0490a1f84b7211ef42c329671':
adb: Transmit key properties in banner of connect message
2ca3e6b35f79136418ebc32fef57580698dbd045 31-May-2012 Scott Anderson <saa@android.com> adb: Generalizing -s to take qualifiers.

Prior to this change, -s could take either a serial number or a
device path (e.g. "-s 01498B1F02015015" or "-s usb:1-4.2"). This
change extends -s to also allow product, model or device names
(e.g. "-s product:mysid"). These new qualifiers will only be
available on devices that are running an adb daemon that provides
properties in the connect message per Change-Id:
I09200decde4facb8fc9b4056fdae910155f2bcb9

The product, model and device are derived from the
ro.product.name, ro.product.model and ro.product.device
properties respectively. They are prefixed with "product:",
"model:" or "device:" as appropriate. In addition, any
non-alphanumerics in the model are changed to underscores.

If the -s parameter matches multiple devices, the result will be
the same as when multiple devices are connected but no -d, -e or
-s option is specified. In general, this means the user will get
"error: more than one device". However for get-state,
get-devpath and get-serialno, they will get "unknown".

The format of "devices -l" was changed to list all of the
qualifiers that are available. The following example output
(with the last digits of the serial numbers replaced with X's) is
with a Galaxy Prime with an older adb daemon and another Galaxy
Prime and Galaxy S both with the enhanced adb daemons:

List of devices attached
016B75D60A0060XX device usb:2-5 product:mysid model:Galaxy_Nexus device:toro
3731B535FAC200XX device usb:1-4.2 product:soju model:Nexus_S device:crespo
01498B1F020150XX device usb:1-4.1

Note that the serial number and state are now column oriented
instead of tab delimited. After the serial number and state, all
qualifiers are listed with each preceded by a space. The output
of the original devices command (without -l) is unchanged.

Change-Id: Iceeb2789874effc25a630d514a375d6f1889dc56
Signed-off-by: Scott Anderson <saa@android.com>
/system/core/adb/adb.h
e82c2db05cae70a0490a1f84b7211ef42c329671 25-May-2012 Scott Anderson <saa@android.com> adb: Transmit key properties in banner of connect message

protocol.txt says that the connect message should have three
fields:

<systemtype>:<serialno>:<banner>

In reality, what is transmitted is simply:

<systemtype>::

The serialno is obtained via other means so doesn't really need
to be a part of the connect message. This change puts the
ro.product.name, ro.product.model and ro.product.device
properties in the <banner> for devices. Each property is
terminated by a semicolon (;) with the key and value separated by
an equals sign (=). Example message:

device::ro.product.name=<prd>;ro.product.model=<mdl>;ro.product.device=<dev>;

Making this change will enable the device list to provide more
information to the user and to give the potential for being able
to select which device to talk to with the -s option.

Change-Id: I09200decde4facb8fc9b4056fdae910155f2bcb9
Signed-off-by: Scott Anderson <saa@android.com>
/system/core/adb/adb.h
fd96db17b7f07eb6615af01fd1908b74383bf04b 13-Jan-2012 Andrzej Pietrasiewicz <andrzej.p@samsung.com> FunctionFS: initial implementation

This is the second version of a patch which demonstrates the possibility
of using adbd (Android Debug Bridge daemon) with a generic FunctionFS gadget
instead of a custom adb usb gadget in the Linux kernel. It contains changes
introduced after Benoit's review - thank you Benoit.

The patch adds a new usb access layer to adbd using FunctionFS. The former
usb access method is still available. The method is chosen at runtime
depending if /dev/usb-ffs/adb/ep0 or /dev/android_adb is accessible.

How to use on the target device:

$ insmod g_ffs.ko idVendor=<vendor ID> iSerialNumber=<some string>
$ mount -t functionfs adb /dev/usb-ffs/adb -o uid=2000,gid=2000
$ ./adbd

This patch requires a patch to bionic which adds <linux/usb_functionfs.h>
which is an exact copy of the relevant file in the linux kernel.

Change-Id: I4b42eb267ffa50fca7a5fba46f388a2f083e8b2d
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[benoit@android.com: detect at runtime if functionfs is mounted
or fallback using f_adb]
Signed-off-by: Benoit Goby <benoit@android.com>
/system/core/adb/adb.h
76e47e0ec84eaf7faf6f77b853ba74345875a8e3 02-May-2012 Scott Anderson <saa@android.com> am 9526a788: Merge "adb: Add ability to specify device path" into ics-aah

* commit '9526a788a6bd528e14622404e8750bdcc147d15a':
adb: Add ability to specify device path
e109d266c12c5f537d429ca4b892f2719e02c2da 20-Apr-2012 Scott Anderson <saa@android.com> adb: Add ability to specify device path

For manufacturing and testing, there is a need to talk to
whatever device is connected to a given port on the host. This
change modifies adb's "-s" option to take either a serial
number or a device path. The device paths of the connected
devices can be listed using "adb devices -l" whose output
will resemble:

List of devices attached
016B75D60A00600D usb:2-5 device
3031D0B2E71D00EC usb:1-4.3 device

The second column lists the device paths. If the -l option is
not given, the output from "adb devices" will be the same as
it used to be (i.e. the paths will not be printed).

The device path can also be obtained with the get-devpath
command:

$adb -s 3031D0B2E71D00EC get-devpath
usb:1-4.3

Note that the format of the device paths are platform dependent.
The example above is from Linux. On OS-X, the paths will be
"usb:" followed by hex digits. For other platforms, the device
paths will be printed as "????????????" and the -s option will
not be able to select a device until someone implements the
underlying functionality.

Change-Id: I057d5d9f8c5bb72eddf5b8088aae110763f809d7
Signed-off-by: Scott Anderson <saa@android.com>
/system/core/adb/adb.h
f366b3698b409405e1ee88476d1186f29fe14b06 16-Mar-2012 Benoit Goby <benoit@android.com> adb: Don't synchronize with transport using sleep

Services that cause adbd to reboot are currently implemented this way:
write(fd, response)
close(fd)
sleep(1)
exit(1)
sleep(1) is necessary to leave time for the transport to transmit
the response before the daemon exits. This is slow and unreliable.
Instead, add a flag to the asocket to make it exit the daemon only
after the socket is closed.

Change-Id: I9df45ea6221f0d9b828703b9b2316a5d4fe59352
/system/core/adb/adb.h
28781b0a52dfb5ad19121afcc6aef56918992b30 27-Feb-2012 Vladimir Chtchetkine <vchtchetkine@google.com> Enables ADBD tracing in the emulator.

When running inside the emulator, guest's adbd can connect to 'adb-debug' qemud
service that can display adb trace messages on condition that emulator has been
started with '-debug adb' option.

This CL enables that functionality in ADB code.

Change-Id: I59b4a76d3c887ad28b8aa8e2a01dfa814e75faa1
/system/core/adb/adb.h
447f061da19fe46bae35f1cdd93eeb16bc225463 09-Jan-2012 Doug Zongker <dougz@android.com> add "adb sideload" and sideload connection state

Recovery will soon support a minimal implementation of adbd which will
do nothing but accept downloads from the "adb sideload" command and
install them. This is the client side command (mostly resurrected out
of the old circa-2007 "adb recover" command) and the new connection
state.

Change-Id: I4f67b63f1b3b38d28c285d1278d46782679762a2
/system/core/adb/adb.h
07edefe4cecbddaf6282e556e04a1e1ef21c404a 22-Jun-2011 Mike Lockwood <lockwood@android.com> Revert "adb: kick the transport after sending the "adb root" command"

This reverts commit d15e6ac95dc898fb78fb5917bb2e4498b40b716f.

Also increment adb version to 1.0.29

Change-Id: I890643f0c18a2fe90f170134df039c54116cecda
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
b0bd6024e344eb49702e24e78654f55254f42e8f 21-Jun-2011 Mike Lockwood <lockwood@android.com> adb: Update version to 1.0.28

Change-Id: Ib8a98d3840abf24cf062112aca7ce462a0f44bc5
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
d15e6ac95dc898fb78fb5917bb2e4498b40b716f 12-Jun-2011 Mike Lockwood <lockwood@android.com> adb: kick the transport after sending the "adb root" command

This is needed because the USB driver on the device no longer resets the bus
when exits and restarts.
Since the host side adb no longer detects that adbd has restarted we need
to reset the connection on the host side now.

Change-Id: I1a8eabd292e8b45c34fa07a8a8b8c609cc15648d
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
702967afb1bebc97c0b8a23c075d4932820ef7a3 18-May-2011 Christopher Tate <ctate@google.com> Add 'adb restore' to parallel 'adb backup'

It won't actually do anything until the 'bu' tool and framework are
updated to respond properly, but this is the adb side of the
necessary infrastructure: we copy the tarfile into the socket pointed
at the device, using the existing mechanisms.

Change-Id: Ic3b5779ade256bd1ad989a94b0685f7b1a7d59d2
/system/core/adb/adb.h
d2f5415c603f7d9961f7a0b05579a0768e071410 21-Apr-2011 Christopher Tate <ctate@google.com> Add 'adb backup' for pulling a full backup tarfile to the host

The direct command interfaces with the 'bu' binary in /system/bin
on the device.

Change-Id: I4cd69eedfe5144c47277573c5626c6ad8755d70b
/system/core/adb/adb.h
408fa57864c01113deaa213e5c1848a9c594ae92 16-Mar-2011 JP Abgrall <jpa@google.com> adb: fix subprocess exit handling, oom adjust fixes, extra debugging.

* Add support for correctly handling subprocess termination in shell service (b/3400254 b/3482112 b/2249397)
- have a waitpid() track the subprocess, then notify the fdevent via a socket
- force an eof on the pty master in fdevent's new subproc handler.
- modify fdevent to force-read the pty after an exit.
* Migrate the "shell:blabla" handling to "#if !ADB_HOST" sections, where it
belongs.
* Fix the race around OOM adjusting.
- Do it in the child before exec() instead of the in the parent as the
child could already have started or not (no /proc/pid/... yet).
* Allow for multi-threaded D() invocations to not clobber each other.
- Allow locks across object files.
- Add lock within D()
- Make sure sysdesp init (mutex init also) is called early.
* Add some missing close(fd) calls
- Match similar existing practices near dup2()
* Add extra D() invocations related to FD handling.
* Warn about using debugging as stderr/stdout is used for protocol.
* Fix some errno handling and make D() correctly handle it.
* Add new adb trace_mask: services.
* Make fdevent_loop's handle BADFDs more gracefully (could occur some subproc closed its pts explicitely).
* Remove obsolete commandline args reported in help. (b/3509092)


Change-Id: I928287fdf4f1a86777e22ce105f9581685f46e35
/system/core/adb/adb.h
0e7c4274c687446dbe30a814278d7a6b99da8c4e 24-Feb-2011 JP Abgrall <jpa@google.com> Revert "Fix adb hang when subprocess dies early."

This is for http://b/3482112 "adb interactions with device causing test harness failures".

This reverts commit 69c5c4c45bd4f1575ae8bdba13795297be7deb8c.

Change-Id: I630bf2e04d2ecf0223bd2af4e87136754ff880d3
/system/core/adb/adb.h
69c5c4c45bd4f1575ae8bdba13795297be7deb8c 18-Feb-2011 JP Abgrall <jpa@google.com> Fix adb hang when subprocess dies early.

* Handling of the subprocess and its FD.
This fixes http://b/3400254 "Many bugreports getting hung at the end in monkey"
- Start up a service thread that waits on the subprocess to terminate,
then closes the FD associated with it.
- Have the event handler select() with a timeout so that it can
detect the closed FD. Select() with no timeout does not return when an FD is closed.
- Have the event handler force a read on the closed FD to trigger the close sequence.
- Migrate the "shell:blabla" handling to "#if !ADB_HOST" sections.
* Fix the race around OOM adjusting.
- Do it in the child before exec() instead of the in the parent as the
child could already have started or not (no /proc/pid/... yet).
* Allow for multi-threaded D() invocations to not clobber each other.
- Allow locks across object files.
- Add lock within D()
* Add some missing close(fd) calls
- Match similar existing practices near dup2()
* Add extra D() invocations related to FD handling.
* Warn about using debugging as stderr/stdout is used for protocol.

Change-Id: Ie5c4a5e6bfbe3f22201adf5f9a205d32e069bf9d
Signed-off-by: JP Abgrall <jpa@google.com>
/system/core/adb/adb.h
c318833b359164f25d7a93f6395c0cad787bacd7 24-Sep-2010 John Michelau <john.michelau@motorola.com> Build adb for target-as-host

Added a new target for adb, so that the adb
host executable is built for the target as
well. This allows the target to connect to
any Android devices which are attached to it.

Bug: 3022194
Change-Id: Ib01983e70b75cec40a9ee161da7f4cf1343eecf2
/system/core/adb/adb.h
cbbe79add1410b53ec65936cfb1b74cac68467f0 24-May-2010 Mike Lockwood <lockwood@android.com> adb connect and disconnect improvements:

Port number is now optional. Will use default port 5555 if not specified.
"adb disconnect" with no additional arguments will disconnect all TCP devices.

Change-Id: I7fc26528ed85e66a73b8f6254cea7bf83d98109f
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
d9d1ca47802395e9e42e7deb05b2683d9d306598 26-Apr-2010 Stefan Hilzinger <hilzinger@google.com> Let "adb connect" connect to emulators too

- adb can now connect to an emulator configured with an arbitrary
pair of <console port, adb port>. These two ports do not have to be
adjacent.
This can be done from the commandline at any time using
adb connect emu:<console_port>,<adb_port>
- Emulators running on ports outside the normal range
(5554/5555-5584/5585) register themselves on startup if they follow
the convention "console port+1==abd port".
- Emulators outside the normal port range will not be auto-detected on
adb startup as these ports are not probed.
- The index into local_transports[] array in transport_local.c does no
longer indicate the port number of the local transport. Use the altered
atransport struct to get the port number.
- I have chosen not to document the adb connect emu:console_port,adb_port
syntax on adb's help screen as this might be confusing to most readers
and useful to very few.
- I don't expect this to introduce any (backwards) compatibility issues.

Change-Id: Iad3eccb2dcdde174b24ef0644d705ecfbff6e59d
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
a84a42eb20d43ffa2695a69d583a6e09532b49d9 19-Apr-2010 Stefan Hilzinger <hilzinger@google.com> Make adb's daemon-port on the host machine configurable.

This is the first CL of a somewhat larger effort which, among other things,
will involve changing the emulator and ddms to talk to adb running on a
configurable port.

The port can be configured using environment variable ANDROID_ADB_SERVER_PORT.

Further CLs will also address the set of ports used for the local transport.

Change-Id: Ib2f431801f0adcd9f2dd290a28005644a36a780a
/system/core/adb/adb.h
505bd6e5fcc576eb3bea87ac86db8aeed86d9a0d 19-Feb-2010 Mike Lockwood <lockwood@android.com> adb: Add five second timeout for USB writes on Linux host.

This helps us recover when things go wrong during automated testing.

Change-Id: I006dbfaff7f70d51398ff12fbddcaee751453b78
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
3166410a82f43d39201be98a8d35c51baa86cb53 21-Oct-2009 Alexey Tarasov <tarasov@dodologics.com> Make get_my_path() safer

Adds maxLen parameter to get_my_path().
Some small cosmetic fixes.
/system/core/adb/adb.h
74d7ff8cfd490852d3df1c4b9d8a21beed619caa 12-Oct-2009 Mike Lockwood <lockwood@android.com> adb: Add "adb disconnect" command for disconnecting TCP/IP devices.

Also check that device is not already connected in "adb connect"

Change-Id: I5f84b56b63d8c6932f23791cac319fd6bc39d36c
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
cef31a02544d91b85481a5fa032b6126dbb32365 26-Aug-2009 Mike Lockwood <lockwood@android.com> adb: Fix emulator support.

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
2f38b699713dc2587a771bd5d4c6a47329728f5e 25-Aug-2009 Mike Lockwood <lockwood@android.com> adb: Improved support for running adb over TCP/IP

Added new commands:

adb connect <host>:<port> (to connect to a device via TCP/IP)
adb tcpip <port> (to restart adbd on the device to listen on TCP/IP)
adb usb (to restart adbd on the device to listen USB)

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
95b837d38b730353af79f8669b5166007e038ac3 08-Aug-2009 Mike Lockwood <lockwood@android.com> adb: On Linux, detect USB devices for which adb does not have permissions to communicate with.

adb devices will now list devices without adequate file system permissions in /dev/bus/usb as:

List of devices attached
???????????? no permissions

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
5f4b051235c3e9e9e5b34b4af885e42a1c711fc4 05-Aug-2009 Mike Lockwood <lockwood@android.com> adb: add "adb reboot" command.

This will allow rebooting the device via adb on any build, including user builds.
An optional argument can be provided
(for example, "adb reboot bootloader" or adb reboot recovery")

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
7bf68842d765ad7e6a51426b625d0de6d2331740 10-Jul-2009 Mike Lockwood <lockwood@android.com> adb: Increment ADB_SERVER_VERSION

It was pointed out that we should have done this when we added the "adb root" command.
And doing this will also force people to pick up the recent Linux USB serial number fix.

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
1f546e6d1f6ccd1964336ddf0d8e8b3b11b1e945 26-May-2009 Mike Lockwood <lockwood@android.com> adb: Allow enabling of device side adbd logging with a persistent system property.

To enable logging, set the property persist.adb.trace_mask to a hex value
containing the bitmask for adb_trace_mask (see the TRACE_* enum values in adb.h).
This will result in adb writing log output to a file in /data/adb/
No logging will occur if persist.adb.trace_mask is not set or has a value
that cannot be parsed as a hex integer.
The property is read once only at startup, so you must reboot or restart adbd
for changes in the property to take effect.

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.h
a481d096feba7cf6e61d54e416a68e2d46498df1 22-May-2009 Xavier Ducrohet <xav@android.com> Support for 3rd party USB Vendor IDs in adb.

Vendor IDs are read from ~/.android/adb_usb.ini. The format is very simple:
1 number per line. First number is ID count, followed by the ID themselves.
Lines starting with # are considered comments.

Other misc changes: moved VENDOR_ID_* to usb_vendors.c to prevent direct
access. Made transport_usb.c reuse the USB constant introduced in usb_osx
(moved them to adb.h)
/system/core/adb/adb.h
a09fbd164d2e088bc5433d310e25640ae048d47d 21-May-2009 Xavier Ducrohet <xav@android.com> Preparation work for adb to support USB vendor Ids provided by SDK add-ons.

Added usb_vendors.* which handles creating (and deleting) a list of vendor ids.
This list is meant to be used everywhere the built-in lists (usb_osx), or the
built-in vendor IDs (transport_usb) were used.

For now the list is only built with the built-in VENDOR_ID_*. Next step
is to read a small file created from all the SDK add-on.

Other misc changes: made is_adb_interface present only if ADB_HOST is true
to prevent accessing a list that doesn't exist (usb_vendors is only
compiled for the host version of adb).
/system/core/adb/adb.h
3fd82b8861aa410fab7785074941b459d92220c1 09-May-2009 Dima Zavin <dima@android.com> adb: osx: Match devices based on interface subclass and protocol

Enumerating all vendor+product id combinations is not practical.
This modifies the matching algorithm to use the adb interface
subclass/protocol instead (0x42/0x1).

Signed-off-by: Dima Zavin <dima@android.com>
/system/core/adb/adb.h
dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/system/core/adb/adb.h
e54eebbf1a908d65ee8cf80bab62821c05666d70 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/system/core/adb/adb.h
35237d135807af84bf9b0e5b8d7f8633e58db6f5 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/system/core/adb/adb.h
4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/system/core/adb/adb.h