History log of /system/core/adb/adb.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d6d4286a28b4a9aef902585625ea6656ab06cf52 06-Sep-2012 Jeff Sharkey <jsharkey@android.com> Bring back ADB_EXTERNAL_STORAGE.

Bug: 7119408
Change-Id: Ic9a23fb6adfb1db771e1e278179586bca69a5edd
/system/core/adb/adb.c
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.c
bfcd810b792f7ffbb2ec1360c0c2662725fd0362 22-Aug-2012 Jeff Sharkey <jsharkey@android.com> Iteration on multi-user external storage.

Define /storage as top-level concept, so that we enforce permissions
uniformly. Moves external storage paths from headers to per-device
environment variables. Added missing mount flags, and we no longer
have adb-specific external storage.

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

This reverts commit f4ed516643ee8ed3a59ad1a8048f7ce5f47f93fb.
/system/core/adb/adb.c
300d6d65d022c4a4663d097e5271eac745be6278 21-Aug-2012 Benoit Goby <benoit@android.com> Merge "adb: Add public key authentification" into jb-mr1-dev
9367f4f973e0d4dfb1fe898709f0246dce6f81aa 21-Aug-2012 John Grossman <johngro@google.com> Replace a segfault with a warning.

Just print a warning if ADB_EXTERNAL_STORAGE is not defined when ADB
runs instead of segfaulting. If we really don't want to continue to
run, we can make this a fatal error instead.

Change-Id: Icfc5fb9e594b0a310029f1dca7e9476f27ceb7bc
/system/core/adb/adb.c
5dd0f86fbfed631b31c9055109889f1d9559a3ea 18-Aug-2012 Jeff Sharkey <jsharkey@android.com> Migrate sdcard0 to shell-accessible location.

Also remove mount() from adb, since it can come online long before
data partition is ready. Set EXTERNAL_STORAGE environment variable
to point to owner for backwards compatibility.

Bug: 7005701
Change-Id: I63444f6636624eb7ad89f053daa289663424639e
/system/core/adb/adb.c
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.c
885342a0f2c834a6b680284047c47c9d04b32565 15-Aug-2012 Jeff Sharkey <jsharkey@android.com> Multi-user external storage support.

Remount rootfs as recursively shared, so that mount changes are
propagated into child namespaces. Mount external storage for access
from adb.

Clean multi-user dependencies for use in Dalvik. Also define
external storage paths.

Bug: 6925012
Change-Id: I375de581a63f4f36667894c56a34a9dd45361e8f
/system/core/adb/adb.c
1dd55c53af264b24319d721281fe32c67c053120 21-Jul-2012 Mike J. Chen <mjchen@google.com> Allow adb to listen both on usb and tcp.

(cherry picked from commit ae868a40459a6bcb89d8a4426503fea0c8002b25 in master)

Change-Id: I980c7c5e8affbc8627d17b1d9303b002adcdb29a
Signed-off-by: Mike J. Chen <mjchen@google.com>

Conflicts:

adb/adb.c
/system/core/adb/adb.c
c29569c5d3c1358983915596267e85e85c7f82e2 07-Jun-2012 Benoit Goby <benoitgoby@google.com> Merge "FunctionFS: initial implementation"
845f106a93d5f8ed710c80293d22d23e1b17ed3c 06-Jun-2012 Scott Anderson <saa@android.com> am 1b7a7e81: adb: Use bionic\'s strtok_r() for Windows

* commit '1b7a7e81195ff06a7482f81cb92b094bb3481cb1':
adb: Use bionic's strtok_r() for Windows
1b7a7e81195ff06a7482f81cb92b094bb3481cb1 06-Jun-2012 Scott Anderson <saa@android.com> adb: Use bionic's strtok_r() for Windows

A recent change use strtok_r which broke the Windows build.
Clear this potential landmine by adding adb_strtok_r to sysdeps.h
in the typical fashion. For Windows, the actual implementation
in sysdeps_win32.c was copied from bionic/libc/string/strtok.c.

Change-Id: Ibb71555bc429f7058c07c3d39e0b62859c79635c
Signed-off-by: Scott Anderson <saa@android.com>
/system/core/adb/adb.c
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.c
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.c
a1020825fb8abdff9289a7473260e5312131e7c8 01-Jun-2012 Scott Anderson <saa@android.com> am c7993af6: adb: Fix compiler warning

* commit 'c7993af64baec271a238646bc20aaa846866c4a9':
adb: Fix compiler warning
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.c
c7993af64baec271a238646bc20aaa846866c4a9 25-May-2012 Scott Anderson <saa@android.com> adb: Fix compiler warning

system/core/adb/adb.c: In function 'connect_device':
system/core/adb/adb.c:1001: warning: comparison between signed and unsigned integer expressions

Change-Id: I206f85395e1d7ad8d6ef130a26c95dcf0f498696
Signed-off-by: Scott Anderson <saa@android.com>
/system/core/adb/adb.c
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.c
eb68fa8153d97f5f8b6d9062fcf91fe393e3bff3 02-Apr-2012 Nick Kralevich <nnk@google.com> adb: set umask to 000

Init is going to be modified to set the umask to 077.
This will impact adb, as "adb install" and "adb sync"
assume that files will be world-readable / writable.

Keep adb's umask at 000 for now.

Bug: 3272072
Change-Id: I75978e8dd7bbdf4dbe7c9a691ef516235f207da2
/system/core/adb/adb.c
50458cf76ea7b0b03598c785acb1481ed0ae5b1d 07-Mar-2012 Dianne Hackborn <hackbod@google.com> Add AID_SDCARD_R.

Change-Id: I47f650e415e06c0b69790ffefea7f208c910ebd7
/system/core/adb/adb.c
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.c
5890fe33141a9efd124c86c40a8c1ff6170ecf20 19-Jan-2012 Nick Kralevich <nnk@google.com> Don't allow adb to run as root in user builds.

Change-Id: I4fbd7beb7f76c68fead1a89b745f0dfb931b4597
/system/core/adb/adb.c
bd9206bc7399b22d3917c737bb75f8534fa77e35 19-Jan-2012 Nick Kralevich <nnk@google.com> Move permission checking code to it's own function.

Change-Id: Ibe46ca3043791f3b3815080f9e23ac307b1f5900
/system/core/adb/adb.c
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.c
ae868a40459a6bcb89d8a4426503fea0c8002b25 08-Dec-2011 Joe Onorato <joeo@google.com> Allow adb to listen both on usb and tcp.

Change-Id: I98db594241631fa17e39686727392afc8b3124bc
/system/core/adb/adb.c
61b90bd211021886049f72cb666a5b49b83b3c64 09-Nov-2011 JP Abgrall <jpa@google.com> adb: grant it AID_NET_BW_STATS for full /proc/net/xt_qtaguid/stats

Normally only bandwidth stats for the uid reading .../stats is returned.
With the extra group, adb shell will be able to read stats from
all UIDs.
This is to be used to offer data usage profiling to developers.

Change-Id: If3d2941ce5aa4dbb1a23947b97b893149ba224f7
/system/core/adb/adb.c
9ff99f653632504b98c17fc76eac3383df5b5d1e 05-Aug-2011 Kenny Root <kroot@google.com> Merge "Default to secure mode"
ff9d3484e6c8f2f7e7e25581cb4dc86e0884d8a7 31-Jul-2011 Kenny Root <kroot@google.com> Default to secure mode

If ro.secure is not set for some reason, default to secure mode.

Change-Id: Id0ce3ea5507a3f9690332fb5a2daef7d3303481d
/system/core/adb/adb.c
514b40bafada989c63f8a3d42a517c6c53e04b02 30-Jul-2011 Nick Kralevich <nnk@google.com> am 189de0c1: am adabe566: am 810cf41b: Merge "Fixed memory leak when using transport:serial."

* commit '189de0c1f4339abd7b938b4905775163d2a94bbe':
Fixed memory leak when using transport:serial.
3175c8e9bfcb01f181d7300755da15a999e5461c 27-Jul-2011 Tom Marlin <tomm@bsquare.com> Fixed memory leak when using transport:serial.

Fixed memory leak when using transport:serial. Code was previously
using strdup() to make a copy of the serial number which was not
necessary. Instead, just set serial=service.

Change-Id: Ifa8fe7999c6fb88955d2c6bdfcd3cd724ec1f020
Signed-off-by: Tom Marlin <tomm@bsquare.com>
/system/core/adb/adb.c
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.c
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.c
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.c
3b4a0c81c4f2af46e6075f1150dcde55d436c7a6 02-Feb-2011 Benoit Goby <benoit@android.com> Fix adb leaking file descriptors to forked processes

accept() creates a new file descriptor that should be closed on exec so
that forked processes don't keep a fd opened on the socket.

This also fixes b/3297070 where adb hangs after running adb on the
target.

Change-Id: I8df511289e5549ae49b4824c9dfb71a3bf85eae8
/system/core/adb/adb.c
3e42db23fbbfdc2866f5ca035641444c5ab2ff78 06-Jan-2011 David 'Digit' Turner <digit@google.com> adb: improve debug traces readability.

This patch makes the traces easier to read. For example transports are
displayed by name/serial instead of their hex address.

Change-Id: I7e8df44ddbec19754d63d989bd56485998b4627b
/system/core/adb/adb.c
95ef82866c7a922bf588027aa38c58a45eb84d9c 02-Feb-2011 Benoit Goby <benoit@android.com> Fix adb leaking file descriptors to forked processes

accept() creates a new file descriptor that should be closed on exec so
that forked processes don't keep a fd opened on the socket.

This also fixes b/3297070 where adb hangs after running adb on the
target.

Change-Id: I8df511289e5549ae49b4824c9dfb71a3bf85eae8
/system/core/adb/adb.c
730ff3b786058dadde98743522d760bd9331a9dd 06-Jan-2011 David 'Digit' Turner <digit@google.com> adb: improve debug traces readability.

This patch makes the traces easier to read. For example transports are
displayed by name/serial instead of their hex address.

Change-Id: I7e8df44ddbec19754d63d989bd56485998b4627b
/system/core/adb/adb.c
4692599cf73240e34d8e3bf7f54e99ebb9c0aaf3 28-Aug-2010 Nick Kralevich <nnk@google.com> am 44db990d: Fix bug 2950316. Check return values.

Merge commit '44db990d3a4ce0edbdd16fa7ac20693ef601b723' into gingerbread-plus-aosp

* commit '44db990d3a4ce0edbdd16fa7ac20693ef601b723':
Fix bug 2950316. Check return values.
44db990d3a4ce0edbdd16fa7ac20693ef601b723 27-Aug-2010 Nick Kralevich <nnk@google.com> Fix bug 2950316. Check return values.

Change-Id: I687bb5fb8195d4c1fc863e32a5e233a8b9e74196
/system/core/adb/adb.c
899913f8168b54e00971c0e8d4ae16d06a4651fe 16-Jun-2010 Viral Mehta <viral.vkm@gmail.com> print msg.command in human-readable format

to print msg.command as some odd decimal number is just not helping in debugging;
instead print msg.command as a string

Change-Id: Id1ec770c20c86b8bdae40a0262bf4b63c0213b0a
/system/core/adb/adb.c
f7e148c1bc482fe7f8df49d216b1f9390f0638b9 03-Jun-2010 The Android Open Source Project <initial-contribution@android.com> merge from open-source master

Change-Id: I9b051ebd6e785e4d68e148a005a0485e79aa55ea
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.c
c57a22c8561cc571d23cd7f321103b2b4d2c7cde 02-Jun-2010 The Android Open Source Project <initial-contribution@android.com> merge from open-source master

Change-Id: I44bd527e51d102a56a1efe40cb6e634859b09461
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.c
9a22c68e8697a2ec86cd238a87a32ea42d7f8d39 28-Apr-2010 The Android Open Source Project <initial-contribution@android.com> merge from open-source master

Change-Id: Id824d3427cb4808a8768f14e7b46c0eaf5e02e73
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.c
23e64161be09ce26cb4d213a860f61e1fe77d975 15-Apr-2010 Mike Lockwood <lockwood@android.com> adb: remove obsolete adb.connected system property.

This was used for adb networking, which no longer exists.
This code also failed when adb was not running as root.

Change-Id: Ied86fb1930094d5ae5009684d25e15385fd31d03
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.c
775a8df614d364fcb82e280069a3f533381240b4 21-Apr-2010 The Android Open Source Project <initial-contribution@android.com> merge from open-source master

Change-Id: I686f28fcfcff1cca7cf254de9e4334cc4ea2fef7
8e2ceaeacf9fa1eb5ac41e4d3498836a6e2c7c97 20-Apr-2010 Mike Lockwood <lockwood@android.com> adb: Add persistent system property for running adb in TCPIP mode

In addition to service.adb.tcp.port, you can now set persist.adb.tcp.port
to specify the port number for adb to listen to instead of USB.
This allows the adb TCP configuration to persist across reboots.

Change-Id: I897ffcb019e8dd1785996d2f3c571cfc2f8ded38
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.c
d969faa161310d0a3792766320daa3200b84bd74 24-Feb-2010 Mike Lockwood <lockwood@android.com> adb: Attempt to unmount the SD card before rebooting.

Change-Id: Idd4d96b4704f4e1bd324e72bca87611a23e30801
Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.c
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.c
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.c
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.c
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.c
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.c
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.c
6a3075c78287ea5a7ee7a3c85cde58e894350822 25-May-2009 Mike Lockwood <lockwood@android.com> adb: Add adbd to the AID_SDCARD_RW group to allow writing to the SD card.

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.c
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.c
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.c
249ad57a887680538d1dc0195e746b1d877ebd6a 20-May-2009 Mike Lockwood <lockwood@android.com> adb: adbd no longer disables OOM and now sets children's OOM adjustment to zero

Signed-off-by: Mike Lockwood <lockwood@android.com>
/system/core/adb/adb.c
e037fd7e193ecccbb5c0888e49f6d58c224bc11d 13-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@138607
/system/core/adb/adb.c
2015549667fb77706a9879e974a3875ebccd8198 11-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@137873
/system/core/adb/adb.c
dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/system/core/adb/adb.c
e54eebbf1a908d65ee8cf80bab62821c05666d70 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/system/core/adb/adb.c
5ae090ed949cea9d1e7ab1552b455a229f8f9757 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
/system/core/adb/adb.c
35237d135807af84bf9b0e5b8d7f8633e58db6f5 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/system/core/adb/adb.c
4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/system/core/adb/adb.c