Commit graph

396 commits

Author SHA1 Message Date
Jeff Sharkey
d8a8979bd9 Merge "Bring back ADB_EXTERNAL_STORAGE." into jb-mr1-dev 2012-09-06 13:08:37 -07:00
Jeff Sharkey
d6d4286a28 Bring back ADB_EXTERNAL_STORAGE.
Bug: 7119408
Change-Id: Ic9a23fb6adfb1db771e1e278179586bca69a5edd
2012-09-06 13:05:40 -07:00
Ying Wang
96535ba620 Dist fastboot and adb for the sdk build.
So they can be downloaded from the build page.
Bug: 7109694

Change-Id: Ibc60d0acbc5d2445c01010fd0bd4654a240b0a88
2012-09-05 10:26:43 -07:00
Benoit Goby
345ca131bb adb: Link statically with libcrypto
Bug: 7063951
Change-Id: I328b76a751aceaae625d64156f22ce3de65678c8
2012-08-31 18:24:07 -07:00
Benoit Goby
64b3103017 adb: Create private key with 0600 mode
Changed key name to force generating new pairs.

Bug: 7092477
Change-Id: I680cb9dd1896ae52b2b29d63533f966e033d823f
2012-08-31 12:31:36 -07:00
Benoit Goby
d5fcafaf41 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
2012-08-23 00:20:06 -07:00
Jeff Sharkey
bfcd810b79 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
2012-08-22 14:28:37 -07:00
Benoit Goby
3fc95a9918 Revert "adb: Add public key authentification"
This reverts commit f4ed516643.
2012-08-20 23:04:11 -07:00
Benoit Goby
300d6d65d0 Merge "adb: Add public key authentification" into jb-mr1-dev 2012-08-20 20:28:51 -07:00
John Grossman
9dd0029a05 Merge "Replace a segfault with a warning." into jb-mr1-dev 2012-08-20 16:48:13 -07:00
John Grossman
9367f4f973 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
2012-08-20 16:38:01 -07:00
Jean-Baptiste Queru
a8b832a897 am 42900c30: am 0874aa0e: Merge "adb: Pick desired product value from command line it follows -p"
* commit '42900c30cf39ea4cdc41cc3671584b7f4f39b8bc':
  adb: Pick desired product value from command line it follows -p
2012-08-20 14:51:53 -07:00
Jean-Baptiste Queru
0874aa0ec4 Merge "adb: Pick desired product value from command line it follows -p" 2012-08-20 14:41:25 -07:00
Jeff Sharkey
5dd0f86fbf 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
2012-08-20 13:11:11 -07:00
Benoit Goby
f4ed516643 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
2012-08-16 21:36:26 -07:00
Jeff Sharkey
885342a0f2 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
2012-08-15 21:10:07 -07:00
Mike J. Chen
1dd55c53af Allow adb to listen both on usb and tcp.
(cherry picked from commit ae868a4045 in master)

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

Conflicts:

	adb/adb.c
2012-08-09 11:43:52 -07:00
Stephen Hines
5f73a6863f am 7accfc2f: am f889f0db: Merge "Trivial signed/unsigned warning fix for adbd"
* commit '7accfc2ffd3d0fb6e6e8985349e8773f1977df59':
  Trivial signed/unsigned warning fix for adbd
2012-08-08 17:44:03 -07:00
Vairavan Srinivasan
8127323f14 adb: Pick desired product value from command line it follows -p
Change-Id: Ic9fb74c99c88479addf3a2cc599b8492ced759d8
2012-08-04 16:40:50 -07:00
Edwin Vane
ae06933cde Trivial signed/unsigned warning fix for adbd
Change-Id: Icd674006bb2b526166960b4f90eb274030d80439
Author: Edwin Vane <edwin.vane@intel.com>
Reviewed-by: Ariel J Bernal <ariel.j.bernal@intel.com>
2012-08-02 09:17:53 -04:00
Edwin Vane
97d2aef6d2 Fix signed/unsigned comparison warning
Trivial warning fix.

Change-Id: I93b905b34155214fc2d211a0d9319f06b67fa193
Author: Edwin Vane <edwin.vane@intel.com>
Reviewed-by: Ariel J Bernal <ariel.j.bernal@intel.com>
2012-08-01 16:36:06 -04:00
Colin Cross
9630ca7dce am d4725517: am ec7d9dc7: Merge "Avoid zombies on androidscreencast"
* commit 'd47255175ede1af31aee9132914e5d14549ba577':
  Avoid zombies on androidscreencast
2012-07-23 19:52:34 -07:00
Yuriy Zabroda
5a536efa5b Avoid zombies on androidscreencast
When using a third party screen capture program called androidscreencast
(http://code.google.com/p/androidscreencast/) to get the framebuffer of
the device, there are tons of screencap zombie processes got left behind.
The issue is also mentioned here: http://code.google.com/p/android/issues/detail?id=22836.
The cause of the issue is that adbd spawns off screencap processes,
and these child processes were not waited to be finished.
This change fixes the issue.

Change-Id: Ife928d65ecf6a2ff39b8b72ddba930fda6733a00
Signed-off-by: Yuriy Zabroda <yuriy.zabroda@ti.com>
2012-07-23 15:23:20 +03:00
Dan Zhang
f53aff6948 Add Kobo's USB vendor ID to adb
Change-Id: I8b86a851e6478d5e8248df4f1e53f3da4dc4b5e0
2012-07-09 16:29:44 -07:00
Benoit Goby
66086a586f am 504dccec: am aeceb517: adb: Fix adb tcpip command
* commit '504dccec97c12283f348838ba0bf88536322ee6b':
  adb: Fix adb tcpip command
2012-06-12 16:46:48 -07:00
Benoit Goby
504dccec97 am aeceb517: adb: Fix adb tcpip command
* commit 'aeceb5174502659cb4fff6de924b54ef7e6cdae7':
  adb: Fix adb tcpip command
2012-06-12 16:44:11 -07:00
Benoit Goby
aeceb51745 adb: Fix adb tcpip command
When running "adb tcpip 5555", adb create a service socket named
"tcpip:5555". Only compare the 6 first chars "tcpip:" to decide if
we enable exit_on_close.

Bug: 6650130
Change-Id: I0835973de044f1cfde0e859ff0277c0ccc2630a3
2012-06-12 16:14:58 -07:00
Benoit Goby
c29569c5d3 Merge "FunctionFS: initial implementation" 2012-06-06 15:51:07 -07:00
Scott Anderson
845f106a93 am 1b7a7e81: adb: Use bionic\'s strtok_r() for Windows
* commit '1b7a7e81195ff06a7482f81cb92b094bb3481cb1':
  adb: Use bionic's strtok_r() for Windows
2012-06-05 18:17:37 -07:00
Scott Anderson
1b7a7e8119 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>
2012-06-05 17:54:27 -07:00
Scott Anderson
0e9e13eb46 am 2ca3e6b3: adb: Generalizing -s to take qualifiers.
* commit '2ca3e6b35f79136418ebc32fef57580698dbd045':
  adb: Generalizing -s to take qualifiers.
2012-06-05 16:21:04 -07:00
Scott Anderson
3fef581bc7 am e82c2db0: adb: Transmit key properties in banner of connect message
* commit 'e82c2db05cae70a0490a1f84b7211ef42c329671':
  adb: Transmit key properties in banner of connect message
2012-06-05 16:21:03 -07:00
Scott Anderson
2ca3e6b35f 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>
2012-06-05 11:13:40 -07:00
Scott Anderson
e82c2db05c 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>
2012-06-05 11:04:55 -07:00
Scott Anderson
e5867141c9 am 3608d832: adb: Fix two problems with device path implementation.
* commit '3608d832425ca3a6d00c4040f3bb979c5aa49899':
  adb: Fix two problems with device path implementation.
2012-06-01 11:08:08 -07:00
Scott Anderson
a1020825fb am c7993af6: adb: Fix compiler warning
* commit 'c7993af64baec271a238646bc20aaa846866c4a9':
  adb: Fix compiler warning
2012-06-01 11:06:17 -07:00
Andrzej Pietrasiewicz
fd96db17b7 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>
2012-05-31 15:00:41 -07:00
Scott Anderson
3608d83242 adb: Fix two problems with device path implementation.
The commands that use "host-serial:<serial-number>:<request>"
service did not handle "-s usb:<path>".  The -s parameter is
passed as the serial number in the protocol and then matched
against either the serial number or device path.  However,
skip_host_serial() in sockets.c did not know about the usb:
syntax, the serial number was parsed incorrectly.  Before this
change:
	$ adb -s usb:1-4.1 get-state
	error: unknown host service
After:
	$ adb -s usb:1-4.1 get-state
	device

Code was added in find_transport() in transport.c to match device
paths, but find_transport() is only used for socket connections
so matching device paths is not needed.

Change-Id: I922cec963659dafadd0fbc8fa36dee3b55fe366c
Signed-off-by: Scott Anderson <saa@android.com>
2012-05-31 14:06:07 -07:00
Scott Anderson
c7993af64b 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>
2012-05-31 11:29:49 -07:00
Xavier Ducrohet
678cc32980 am c7a67d0f: resolved conflicts for merge of 246808be to jb-dev-plus-aosp
* commit 'c7a67d0fc4121abb0bc5f11aeda4d848ea8e0690':
  Add USB Vendor ID for Yulong Coolpad.
2012-05-15 11:29:59 -07:00
Xavier Ducrohet
c7a67d0fc4 resolved conflicts for merge of 246808be to jb-dev-plus-aosp
Change-Id: I3415e2d7b4e8295b7415951c0e8a78c775574089
2012-05-15 10:44:29 -07:00
Xavier Ducrohet
246808bedf Add USB Vendor ID for Yulong Coolpad.
Bug: 6217375

Change-Id: I8931c42e8d3088cc4df8c6e56b323a7392cad5ef
2012-05-14 15:00:25 -07:00
Jean-Baptiste Queru
51a958645c am 9dbcbe08: am 9bdedb59: am a36e1aa3: Merge "adb: usb_windows: fix adb connection lost issue"
* commit '9dbcbe08751bacbf1fcbf6037fed1e6c69a27fa3':
  adb: usb_windows: fix adb connection lost issue
2012-05-14 08:37:37 -07:00
Jean-Baptiste Queru
9dbcbe0875 am 9bdedb59: am a36e1aa3: Merge "adb: usb_windows: fix adb connection lost issue"
* commit '9bdedb599874278abf206230ed31010eeb9b40dd':
  adb: usb_windows: fix adb connection lost issue
2012-05-11 21:58:10 -07:00
Jack Ren
1c4b760a5d adb: usb_windows: fix adb connection lost issue
Windows adb connection could be lost if the target
side kernel enables the kmemleak.

The root cause is that kmemleak downgrades USB
performance, and lead to Windows adb host application
timeout because usb_write()/usb_read()'s timeout time is
very short. That issue is not reproducible in Linux
host because its usb_write() timeout is 5s and usb_read()
is blocked until return:
                usb_write()         usb_read()
Linux           5000ms              blocked until return
Windows         500+len*8 ms        500+len*8 ms

To fix that issue, extend the Windows adb host usb_write
timeout time to 5 seconds and usb_read() as a blocked routine:
                usb_write()         usb_read()
Windows         5000ms              blocked until return

Change-Id: If54e2b4c396a5a06318c0ee0b3326a00e7661fbc
Signed-off-by: Yu Wang <yu.y.wang@intel.com>
Signed-off-by: Jin Can Zhuang <jin.can.zhuang@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-05-09 23:08:12 +08:00
Jean-Baptiste Queru
69b2e7dd12 am 007b7002: am 2ae9878c: am c5d5a5e8: Merge "Kindle Fire USB ID"
* commit '007b70023b179f846c0ad1f0303da4ce03ac065e':
  Kindle Fire USB ID
2012-05-02 15:14:04 -07:00
Jean-Baptiste Queru
007b70023b am 2ae9878c: am c5d5a5e8: Merge "Kindle Fire USB ID"
* commit '2ae9878cd5dc517cc7338aaca81f0eb3127b4a53':
  Kindle Fire USB ID
2012-05-02 15:11:08 -07:00
Scott Anderson
76e47e0ec8 am 9526a788: Merge "adb: Add ability to specify device path" into ics-aah
* commit '9526a788a6bd528e14622404e8750bdcc147d15a':
  adb: Add ability to specify device path
2012-05-01 19:33:41 -07:00
Anonymous Coward
4474ac4081 Add encryption parameters to adb install
Change-Id: I92e5f6ace1bc9e711c14cb83533aeb99ab9ab9f7
2012-04-27 13:48:54 -07:00
Scott Anderson
e109d266c1 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>
2012-04-20 11:21:14 -07:00