Commit graph

675 commits

Author SHA1 Message Date
Elliott Hughes
0173ebd531 am 5f8d9c01: Merge "adb: add vendor ID\'s for Nook, Haier, Hisense, and MTK"
* commit '5f8d9c012cf28fad57d0896b938b05e2c976073f':
  adb: add vendor ID's for Nook, Haier, Hisense, and MTK
2013-06-17 13:51:46 -07:00
Elliott Hughes
865bb05dd0 Merge "adb: fix reported transfer size for transfer over 4 GiB" 2013-06-17 20:49:25 +00:00
Jeff Smith
71150ce4ef adb: add vendor ID's for Nook, Haier, Hisense, and MTK
Change-Id: I156ff750ef9ae66113d1e0e3ceffea047abc03b9
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
2013-06-17 13:21:04 -05:00
Jeff Smith
d9a1430ff2 adb: fix reported transfer size for transfer over 4 GiB
When transferring files over 4 GiB with adb, the size of the transfer
is misreported.

Change-Id: Ia3d4cae1e9f82b4f7432341820b101ea9a44f85b
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
2013-06-15 16:03:54 -05:00
Nick Kralevich
893a4a47e8 adb: Only use properties on device builds
When building for the host, don't make reference to
property_get / property_set.  I'm in the process of removing
host side support for properties.

Change-Id: I691c5872b5fd538e78bc38a3fe72574cdc7f43c3
2013-05-23 10:37:46 -07:00
kongfanqing
cabb75e427 Modify BYD's USB Vendor ID
Change-Id: I391487a12ba7ed86aac81457f8026acd3fd7576c
2013-05-15 14:17:41 +08:00
Kenny Root
928116ceef Host builds: add fastboot and adb
Add fastboot and adb host utilities to debug builds for debugging
and development purposes.

Change-Id: If77699a27497b8641998930f14d4ee418b856080
2013-05-02 09:51:53 -07:00
Benoit Goby
15e84ad042 Merge "adb: Handle adb connect in a thread" 2013-04-25 22:43:54 +00:00
Nick Kralevich
44a5fb5704 Merge "fs_mgr: make block devices read-only" 2013-04-25 20:22:20 +00:00
Benoit Goby
1c45ee92e2 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
2013-04-25 12:34:49 -07:00
Benoit Goby
9470c2f1ab adb: Cleanup dead code
dns_service is unused and recover_service has been replaced by adb
sideload

Change-Id: Ie90000d7f672e8299ee1622a9690c7371b214dc1
2013-04-24 21:31:45 -07:00
Nick Kralevich
e18c0d508a fs_mgr: make block devices read-only
When a filesystem is mounted read-only, make the underlying
block device read-only too. This helps prevent an attacker
who is able to change permissions on the files in /dev
(for example, symlink attack) from modifying the block device.

In particular, this change would have stopped the LG Thrill / Optimus
3D rooting exploit
(http://vulnfactory.org/blog/2012/02/26/rooting-the-lg-thrill-optimus-3d/)
as that exploit modified the raw block device corresponding to /system.

This change also makes UID=0 less powerful. Block devices cannot
be made writable again without CAP_SYS_ADMIN, so an escalation
to UID=0 by itself doesn't give full root access.

adb/mount: Prior to mounting something read-write, remove the
read-only restrictions on the underlying block device. This avoids
messing up developer workflows.

Change-Id: I135098a8fe06f327336f045aab0d48ed9de33807
2013-04-24 08:53:26 -07:00
Nick Kralevich
ca8e66a8b0 Make init handle reboots
Move the responsibility for rebooting the system from the
reboot command to init. Init is in a better position to take
actions to bring the system down cleanly, including making sure
filesystems are mounted read-only.

The only UIDs which can perform an init triggered reboot are
root, system, and shell.

Modify the reboot command so that it calls into init to perform
the reboot. The reboot command no longer requires CAP_SYS_BOOT.

Remove the -n reboot option and code which supports it.  Anyone needing
to do an unclean shutdown can just do a 'echo c > /proc/sysrq-trigger'.

Modify adb so that it calls into init to perform a shutdown.

Bug: 8646621
Change-Id: I84c0513acb549720cb0e8c9fcbda0050f5c396f5
2013-04-23 13:21:40 -07:00
Colin Cross
5192363226 am b544da0b: am d7cab8bf: Merge "adb : add missing connection states"
* commit 'b544da0be42cdd1e28d6562a26215d57c51b2f2b':
  adb : add missing connection states
2013-04-17 15:13:27 -07:00
Colin Cross
b544da0be4 am d7cab8bf: Merge "adb : add missing connection states"
* commit 'd7cab8bff1334ba48620a16d1b98f2ae623fee7d':
  adb : add missing connection states
2013-04-17 15:11:39 -07:00
Colin Cross
d7cab8bff1 Merge "adb : add missing connection states" 2013-04-17 21:45:45 +00:00
Elliott Hughes
50970341bf am ac76c1f1: am ffc5a4a5: Merge "Add OUYA VID to known VID list"
* commit 'ac76c1f16f889140ec5c56faccd676c2ff15d7bc':
  Add OUYA VID to known VID list
2013-04-17 09:30:59 -07:00
Elliott Hughes
ac76c1f16f am ffc5a4a5: Merge "Add OUYA VID to known VID list"
* commit 'ffc5a4a529338c834954e58de2701572eb0752f0':
  Add OUYA VID to known VID list
2013-04-17 09:27:37 -07:00
Al Sutton
21ec0516cf Add OUYA VID to known VID list
Add the OUYA VID to the list of known USB VIDs to allow developers with OUYA
consoles to have their device automatically recognized.

Change-Id: I499114d8071747b972c24681fc0771f000ad9f9d
2013-04-17 09:20:05 -07:00
trevd
a5ad539cff adb : add missing connection states
Both CS_RECOVERY and CS_SIDELOAD where not being checked by
connection_state_name which resulted in adb get-state returning
unknown when a device is in those modes.

Change-Id: I00716024d6a0bdb68d6e2380c8cd7b5d056bd15f
Signed-off-by: trevd <trevd1234@gmail.com>
2013-04-17 14:34:23 +01:00
Doug Zongker
515e1639ef mincrypt: support SHA-256 hash algorithm
- adds a library to compute the SHA-256 hash

- updates the RSA verifier to take an argument specifying either SHA-1
  or SHA-256

- updates DumpPublicKey to with new "key" version numbers for
  specifying SHA-256

- adds new argument to adb auth code to maintain existing behavior

Change-Id: I5b1406cf57c2b8993f6032eda3e29139f7740839
2013-04-10 14:33:31 -07:00
Benoit Goby
05d6a649a3 am 9f25178a: am 7f8fb3ff: Merge "adb: Prevent registering usb_disconnect twice" into jb-mr2-dev
* commit '9f25178a9dd0aa8fab5e74f785c9997ae230a325':
  adb: Prevent registering usb_disconnect twice
2013-04-02 11:03:18 -07:00
Benoit Goby
9f25178a9d am 7f8fb3ff: Merge "adb: Prevent registering usb_disconnect twice" into jb-mr2-dev
* commit '7f8fb3ffa2a234b704fc975fc9b1001f17df9cac':
  adb: Prevent registering usb_disconnect twice
2013-04-02 08:24:36 -07:00
Benoit Goby
b66356cab6 adb: Prevent registering usb_disconnect twice
adbd can receive multiple AUTH_RSAPUBLICKEY packets. This happens for
example when booting with usb attached when we retry authenticating
after the framework is done booting. Make sure usb_disconnect is only
registered once, otherwise this creates a loop in the disconnects list.

Bug: 8504991
Change-Id: Ia1f9a37005dd17b7eefee1493d622e1679263eea
2013-04-01 17:39:06 -07:00
Colin Cross
b2ba42a5d3 am b1d20464: am f5562cb6: Merge "adb: Remove execute permission on usb_vendor.c"
* commit 'b1d204648eb8061aa59bed189ce41938fa40197a':
  adb: Remove execute permission on usb_vendor.c
2013-03-29 17:58:46 -07:00
Colin Cross
b1d204648e am f5562cb6: Merge "adb: Remove execute permission on usb_vendor.c"
* commit 'f5562cb66c1c15d65bc372ede4c180430e1ce9d7':
  adb: Remove execute permission on usb_vendor.c
2013-03-29 17:13:45 -07:00
Benoit Goby
243667a98e am 78420edc: resolved conflicts for merge of 35200422 to jb-mr2-dev-plus-aosp
* commit '78420edc0f3e99684c36f0d516744b4d9312a1c1':
  Add BYD's USB Vendor ID
  Add USB Vendor ID for Xiaomi
  Add vendor IDs to adb
2013-03-29 16:43:13 -07:00
Benoit Goby
f8cfa8a1e4 adb: Remove execute permission on usb_vendor.c
Change-Id: Ia4f2e0171634764bde3593593b3c99184236528f
2013-03-29 16:33:02 -07:00
Benoit Goby
78420edc0f resolved conflicts for merge of 35200422 to jb-mr2-dev-plus-aosp
Change-Id: I754b8b17a7e3a6e4ef3ccf0a02beca0fc72ba749
2013-03-29 16:29:22 -07:00
sunxiaoqi
92eb583833 Add BYD's USB Vendor ID
Change-Id: I0694ed72d70638f0a4a252b1c802ae8f4e33385e
2013-03-29 14:57:44 -07:00
Gary Hua
d3b69404a1 Add USB Vendor ID for Xiaomi
Change-Id: I9f0622e05334a5074604bd88093172654b4c3e7d
Signed-off-by: Gary Hua <huachengping@xiaomi.com>
2013-03-29 14:56:53 -07:00
Sam Lin
df6d7666fd Add vendor IDs to adb
Adding vendor IDs to adb for device partners:
  AnyDATA, Harris & Oppo

Change-Id: Ib8c5196c53599bd6eb077871cd95ccac935c42e7
2013-03-29 14:51:15 -07:00
Benoit Goby
c6d7e200ed toolbox: Make reboot a separate command from toolbox
Set the CAP_SYS_BOOT filesystem capability on the new reboot
command and keep CAP_SYS_BOOT in adb bounding set so that the
shell user can run it.

Change-Id: I1dd6143445ee2a952254f0452ab6e544318431dd
2013-03-26 12:24:10 -07:00
Sam Lin
644b6afdac Add vendor IDs to adb
Adding vendor IDs to adb for device partners:
  AnyDATA, Harris & Oppo

Change-Id: Ib8c5196c53599bd6eb077871cd95ccac935c42e7
2013-03-12 20:19:53 +08:00
Elliott Hughes
dd0d0e78af am 822ea9b3: am fd5c6b9f: Merge "Close adb_usb.ini after reading it"
* commit '822ea9b3d1cf240b16135e1b5c3bd926c02d17d6':
  Close adb_usb.ini after reading it
2013-03-08 18:32:02 -08:00
Elliott Hughes
fd5c6b9f13 Merge "Close adb_usb.ini after reading it" 2013-03-09 01:20:08 +00:00
Christopher Tate
0c06eb5017 DO NOT MERGE - Document new -obb flag for adb backup
Now that adb backup handles OBB file backup/restore.

(Cherrypicked)

Change-Id: Ie92b546e3898b62d74f552ab577b7756ad176ee6
2013-03-08 15:09:51 -08:00
Colin Cross
95b087fa90 am 79d4381a: am 69f3ec84: Merge "Fix issues where the filename is referred to as \'sideload\'"
* commit '79d4381a8e838d7ddbeda5b7dc90e0c5bca5a8c6':
  Fix issues where the filename is referred to as 'sideload'
2013-03-05 18:52:29 +00:00
Magnus Eriksson
86ae6d587b Fix issues where the filename is referred to as 'sideload'
The adb sideload utility referes to the filename as 'sideload' in some
places. This patch changes the printouts to display the filename instead.

Change-Id: I38ada01a08bed53a8d9697c03f55ce8cee2abe12
Signed-off-by: Magnus Eriksson <eriksson.mag@gmail.com>
2013-03-05 07:37:32 +01:00
Nick Kralevich
277626e59d am 844306bd: am cc4499b6: Merge "adb: use correct header file."
* commit '844306bd9cb3c8b3e514e5d91e9514556e8f95f4':
  adb: use correct header file.
2013-02-28 23:22:04 +00:00
Nick Kralevich
e2864bf727 adb: use correct header file.
Change-Id: I7a66ced762dc077247fd7c2714ae8850ffdcaeb9
2013-02-28 14:12:58 -08:00
Nick Kralevich
4c609e9683 Remove CAP_NET_RAW from adb
ping no longer needs CAP_NET_RAW. See:

* http://lwn.net/Articles/443051/
* https://android-review.googlesource.com/52090
* https://android-review.googlesource.com/52072

Eliminate the CAP_NET_RAW special case in adb

Change-Id: If9d32c5254291b123b06bededc94b64113f6b8f2
2013-02-27 13:15:02 -08:00
Benoit Goby
1531c966c1 Merge "adb: Fix secure adb when booting with usb attached" 2013-02-21 23:55:57 +00:00
Nick Kralevich
080427e4e2 adb: drop capability bounding set on user builds
run-as: don't require CAP_DAC_OVERRIDE.

Prevent an adb spawned application from acquiring capabilities
other than

* CAP_NET_RAW
* CAP_SETUID
* CAP_SETGID

The only privileged programs accessible on user builds are
* /system/bin/ping
* /system/bin/run-as

and the capabilities above are sufficient to cover those
two programs.

If the kernel doesn't support file capabilities, we ignore
a prctl(PR_CAPBSET_DROP) failure. In a future CL, this could
become a fatal error.

Change-Id: I45a56712bfda35b5ad9378dde9e04ab062fe691a
2013-02-15 21:22:19 -08:00
Nick Kralevich
b9c087031b am e149855a: am 523a2090: Merge "adb: Use 64 bit capabilities."
* commit 'e149855a816c98149a95725139ae66f193049ddd':
  adb: Use 64 bit capabilities.
2013-02-15 10:22:08 -08:00
Nick Kralevich
109f4e16cb adb: Use 64 bit capabilities.
Fix the following kernel warning:

$ adb shell dmesg | grep adb
<6>[    7.813003] warning: `adbd' uses 32-bit capabilities (legacy support in use)

Change-Id: I3912302c5c577f1cb03f0c591834ab7b3a72ddf5
2013-02-15 09:33:13 -08:00
Benoit Goby
045a4a9c3a adb: Fix secure adb when booting with usb attached
When booting with usb attached, the secure adb authentication happens
long before the framework is done booting, so adb can't notify the
framework to install the public key.

Change-Id: Id2af6cebece345022f56cb0c4b5af24e1d7a425c
2013-02-02 01:19:06 +00:00
Kenny Root
49f0f77693 am 282caf3b: am 260f3471: am f8afaebe: Merge "Windows adb: include stdint.h for uint8_t on MinGW-w64"
# By Ray Donnelly
# Via Android Git Automerger (2) and others
* commit '282caf3bd0dfd81b92ac74e0b3ea970d195fee7b':
  Windows adb: include stdint.h for uint8_t on MinGW-w64
2013-01-29 21:54:00 -08:00
Kenny Root
53e5b24231 am 6c3d3ccf: am d033739d: am d40fd86e: Merge "Windows adb: initialize on to 1 in disable_tcp_nagle"
# By Ray Donnelly
# Via Android Git Automerger (2) and others
* commit '6c3d3ccfa5d1d77b80e5c7619909a48b976c69ec':
  Windows adb: initialize on to 1 in disable_tcp_nagle
2013-01-29 21:53:59 -08:00
Kenny Root
f8afaebec3 Merge "Windows adb: include stdint.h for uint8_t on MinGW-w64" 2013-01-30 05:44:17 +00:00
Kenny Root
d40fd86ec5 Merge "Windows adb: initialize on to 1 in disable_tcp_nagle" 2013-01-30 05:43:33 +00:00
Benoit Goby
8e85644aa1 Merge "adb: Add "unauthorized" connection state" 2013-01-29 00:17:43 +00:00
Benoit Goby
83dee8e4e5 Merge "adb: Read secure adb keys on every auth request" 2013-01-28 23:33:28 +00:00
David Turner
5bf8a4200c am 3dbcb6d6: am 98d07897: Merge "Windows adb: Make client stdout and stderr handles uninheritable"
* commit '3dbcb6d6c6befc406e4ce4e2b7aa9ad2635dfbb8':
  Windows adb: Make client stdout and stderr handles uninheritable
2013-01-21 02:56:36 -08:00
David Turner
98d0789772 Merge "Windows adb: Make client stdout and stderr handles uninheritable" 2013-01-21 10:16:54 +00:00
Benoit Goby
77e8e5851d 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
2013-01-15 17:21:13 -08:00
Benoit Goby
345cb066d2 adb: Read secure adb keys on every auth request
The framework can now clear the user key list, so we need to reload the
key list on every auth request instead of loading it once when adbd
starts.
This also fixes issues with encrypted devices, where the user key file
is only readable after the user has unlocked the device.

Change-Id: I350c5aab986f8ca86b95f316398d03012553e581
2013-01-15 17:16:22 -08:00
Ray Donnelly
bbe26c1f79 Windows adb: initialize on to 1 in disable_tcp_nagle 2013-01-11 16:36:00 +00:00
Ying Wang
2c43b55814 resolved conflicts for merge of f62f1e3a to master
Change-Id: I35c66859e2c454c20c8acc6b2b1f0833032205bb
2013-01-10 15:35:05 -08:00
JP Abgrall
571c136768 adb: HACK: (linux only) allow temp mitigation for multithreaded issues
There are serious multithreading issues between the fdevent and transport
subsystems which both manipulate struct asocket and struct fde concurrently.
The prevalent symptom being around multiple socket closures which stomp
 on each other, typically causing:
   "glibc detected *** adb: double free or corruption ..."

This HACK allows forcing CPU affinity via an env var. E.g.:
  export ADB_CPU_AFFINITY_BUG6558362=0
which will cause ONLY the adb server and all its threads to be pegged
to CPU 0.

The result is visible in valgrind's helgrind: no *socket_close() related
data races. But tons of other races are still there.

Bug: 6558362
Change-Id: I0f112390a6a921c64b2a783297be9e99ce27fd56
2013-01-09 15:34:21 -08:00
Ray Donnelly
cbb9891049 Windows adb: include stdint.h for uint8_t on MinGW-w64
Change-Id: I84b8284bc034feb0acd313b0aad9e2fa5868854f
2013-01-08 23:11:49 +00:00
Ray Donnelly
267aa8b00e Windows adb: Make client stdout and stderr handles uninheritable
Change-Id: Ib0519a199c9504aad1d0ecc3757f4d162984bf22
2013-01-08 23:02:28 +00:00
Ying Wang
ef2ea99bfe Merge "Correct LOCAL_LDLIBS of adb" 2013-01-08 13:56:07 -08:00
jp abgrall
d7c52a458e am 03873ce4: am 77eccafe: Merge "Support adb client connect to remote server"
* commit '03873ce495e8c4bdb1289cdfa2b97cb47bb15108':
  Support adb client connect to remote server
2013-01-04 12:08:28 -08:00
Matt Gumbel
d7b3308511 Support adb client connect to remote server
ADB client: allow user to specify hostname and port number of remote
adb server.
ADB server: bind server to all network interfaces instead of just
localhost when user gives -a flag.

Primary use-case for this change is to support remote testing of USB
devices. HostA is running some test automation software which invokes adb
client. HostB has USB-only device attached and is running adb server. adb
client on HostA makes connection to adb server on HostB to talk to the
USB device.

Change-Id: I845cc8c00350b400317f8c18f813e6fd79bd5470
Signed-off-by: Dean Kwon <daex.i.kwon@intel.com>
Signed-off-by: Jim Bride <jim.bride@intel.com>
Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
2013-01-04 11:00:38 -08:00
Chih-Wei Huang
9c60755207 Correct LOCAL_LDLIBS of adb
adb doesn't really use ncurses-libs, remove it.

Add -ldl for the symbols dlclose, dlerror, dlopen...
introduced from dso_dlfcn.c of libcrypto_static.a.

Change-Id: If1cc23987a9b35ec535bbf8f4e7db141b9f10af7
2013-01-01 15:57:40 +08:00
David 'Digit' Turner
9bc6f20c61 am abf7cc97: am 13306d95: Merge "adb: Improve ADB\'s forward redirection management."
* commit 'abf7cc977e41540c45836d2fafd81606117f0399':
  adb: Improve ADB's forward redirection management.
2012-12-13 18:25:53 -08:00
David 'Digit' Turner
0d82fbf04d adb: Improve ADB's forward redirection management.
This adds a few new options/modes to 'adb forward':

  adb forward --list
  adb forward --remove <local>
  adb forward --remove-all
  adb forward --no-rebind <local> <remote>

For more context, see http://code.google.com/p/android/issues/detail?id=39631

Note that this only affects the host adb client and server programs,
i.e. it's compatible with devices running older adbd versions.

Change-Id: I9cda3ba12b5a8560a2061620bc7f948e5c1e70f7
2012-11-26 21:37:08 +01:00
Chris Dearman
60529e39bb Close adb_usb.ini after reading it
Signed-off-by: Chris Dearman <chris@mips.com>
Change-Id: I7d3ee8cbd54af206dac89225c438e6c7322c571f
2012-11-16 14:58:26 -08:00
Xavier Ducrohet
846c686b66 am 493d04d2: am f621d62a: am c4244565: am d1e39491: Add usb vendor id for Teleepoch.
* commit '493d04d2fec59b273a067f5ef9d908dd0b441a08':
  Add usb vendor id for Teleepoch.
2012-11-08 06:21:12 -08:00
Xavier Ducrohet
493d04d2fe am f621d62a: am c4244565: am d1e39491: Add usb vendor id for Teleepoch.
* commit 'f621d62adcbcd81d6479223d9afe47c1d966710d':
  Add usb vendor id for Teleepoch.
2012-11-08 06:14:18 -08:00
Xavier Ducrohet
d1e39491f0 Add usb vendor id for Teleepoch.
Change-Id: I82bbfed598fc3a886681c4139600cf487034c59c
2012-11-06 12:56:14 -08:00
Kenny Root
1dcaf9d054 am 51ccef27: Merge "Add TEMP_FAILURE_RETRY macro for darwin"
* commit '51ccef27cab58277775e62518a59666d2a059b62':
  Add TEMP_FAILURE_RETRY macro for darwin
2012-10-13 13:54:34 -07:00
Kenny Root
89c2812bd6 Add TEMP_FAILURE_RETRY macro for darwin
Darwin doesn't define the TEMP_FAILURE_RETRY macro in unistd.h so we
need to add it everywhere. Joy!

(cherry picked from commit ec90f1dc11)

Change-Id: Ida554fc65193672cc4616dec79e6282e06cc1b28
2012-10-13 12:35:03 -07:00
Kenny Root
ec90f1dc11 Add TEMP_FAILURE_RETRY macro for darwin
Darwin doesn't define the TEMP_FAILURE_RETRY macro in unistd.h so we
need to add it everywhere. Joy!

Change-Id: Ida554fc65193672cc4616dec79e6282e06cc1b28
2012-10-13 12:33:11 -07:00
Kenny Root
c5333e494d am 1dc92bac: am 207c17ff: Merge "Make adb robust against EINTR"
* commit '1dc92bacb8cbf052438e0b1af4030a57901d6e94':
  Make adb robust against EINTR
2012-10-13 00:01:37 -07:00
Kenny Root
1dc92bacb8 am 207c17ff: Merge "Make adb robust against EINTR"
* commit '207c17ff1f48d0db3c69628bb036a14db40b5887':
  Make adb robust against EINTR
2012-10-12 23:59:22 -07:00
Kenny Root
73167412bc Make adb robust against EINTR
Change-Id: I39a8d9007ce2d5662a33a50e4d7e2e7f8f9fad63
2012-10-12 15:28:37 -07:00
Kenny Root
d5d6d97def Host builds: add fastboot and adb
Add fastboot and adb host utilities to debug builds for debugging
and development purposes.

Change-Id: If77699a27497b8641998930f14d4ee418b856080
2012-09-26 10:01:40 -07:00
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
Jon Sawyer
775ab9c99e Kindle Fire USB ID
Adds Lab126's USB id to the known USB Devices

Change-Id: I3cd5d90bba68123d5d3d2d67e1ab7d60137eb388
Signed-off-by: Jon Sawyer <jon@cunninglogic.com>
2012-04-15 12:39:59 -07:00
Nick Kralevich
eb68fa8153 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
2012-04-02 14:10:56 -07:00
JP Abgrall
f91259a8f0 adb: fix non-linux builds. tcpip:, root:, usb: are not for ADB_HOST
The handling of adb root:/tpcip:/usb: is normally only for non-ADB_HOST.
This avoids getuid() being invoked on windows builds.

Change-Id: I365b81d9f70de99b9347d3eac82e690a8ac5e747
2012-03-30 13:19:11 -07:00
JP Abgrall
d7f1feb5c8 adb: fix exit of "adb root" when it is a no-op.
"adb root" creates a socket, then starts the service.
Socket creation should not set the exit_on_close when the service will be
a no-op.

Bug: 6259353
Change-Id: Ie526d2fad64f39a48051ed0ff6fb3405c2802ced
2012-03-30 11:19:16 -07:00
Kenny Root
9a7611fefa Merge "Revert "add IP checking for adb over TCP"" 2012-03-28 15:45:16 -07:00
Kenny Root
9a77f55aad Revert "add IP checking for adb over TCP"
This reverts commit dca76e6187
2012-03-28 15:45:08 -07:00
Kenny Root
29dc792bcd Merge "add IP checking for adb over TCP" 2012-03-28 15:15:29 -07:00
Kenny Root
60733e9280 Make sure "adb install" work is cleaned after error
If an error occurs during the verification of an APK, it could be left
in the temporary installation directory.

Change-Id: I4afa5535fc0b978532b31d5b8fb63776963c39db
2012-03-26 16:14:07 -07:00
Benoit Goby
4d668e013b Merge "adb: Don't synchronize with transport using sleep" 2012-03-26 12:56:56 -07:00
Benoit Goby
62e5cbaebc Merge "Revert "Reimplement the "adb root" command to more closely match its previous behavior"" 2012-03-26 12:56:49 -07:00
Andrew Hsieh
8ee361cb01 Remove duplicated VENDOR_ID_INTEL
VENDOR_ID_INTEL defined and appear in builtInVendorIds[] twice.
Remove the 2nd one.

Change-Id: I62f7bba392012aafb8ea9730959362db4bc6c669
2012-03-23 15:28:56 +08:00
Benoit Goby
f366b3698b 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
2012-03-16 15:30:05 -07:00
Benoit Goby
7941cf87f6 Revert "Reimplement the "adb root" command to more closely match its previous behavior"
This reverts commit 535164e9d9.
2012-03-16 15:30:05 -07:00
Benoit Goby
9f1af8cde9 adb: Remove unused flags
BUILD_ADBD is always true

ANDROID_GADGET is not used in the code anymore. adbd now checks at
runtime if /dev/android_adb is present

Change-Id: If6c3278606c79cc74d1ef5978e7b8e3a4513aef8
2012-03-16 15:29:34 -07:00
Wei Zhong
dca76e6187 add IP checking for adb over TCP
whitelist connection for
1) emulator
2) "eng" or "tests" build, or
3) IP matches with "persist.service.adb.client_ip"

Change-Id: I8ac149149873f3bd206bd4d5abc063e5274fb468
Signed-off-by: Wei Zhong <wzhong@google.com>
2012-03-15 14:40:11 -07:00
Dianne Hackborn
50458cf76e Add AID_SDCARD_R.
Change-Id: I47f650e415e06c0b69790ffefea7f208c910ebd7
2012-03-08 14:30:32 -08:00
Vladimir Chtchetkine
28781b0a52 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
2012-02-27 10:41:53 -08:00
Anatol Pomazau
fc656103db Fix 'extra tokens at end of #endif directive' warning
Change-Id: I464ede415e64cf7db845bb441754120974bcf855
2012-02-13 18:12:18 -08:00
Xavier Ducrohet
46f86f11d4 am 0c054095: am 746f3243: Add USB vendor IDs for Quanta, INQ and Sony.
* commit '0c05409510037fd7372c3fe7ab240ebf33b15831':
  Add USB vendor IDs for Quanta, INQ and Sony.
2012-01-24 11:32:19 -08:00
Xavier Ducrohet
05025357e6 am 746f3243: Add USB vendor IDs for Quanta, INQ and Sony.
* commit '746f3243f6d30ab51a36dcfea76eac3ba29ac625':
  Add USB vendor IDs for Quanta, INQ and Sony.
2012-01-24 11:29:52 -08:00
Xavier Ducrohet
0c05409510 am 746f3243: Add USB vendor IDs for Quanta, INQ and Sony.
* commit '746f3243f6d30ab51a36dcfea76eac3ba29ac625':
  Add USB vendor IDs for Quanta, INQ and Sony.
2012-01-24 11:29:50 -08:00
Xavier Ducrohet
746f3243f6 Add USB vendor IDs for Quanta, INQ and Sony.
Change-Id: I224e067d9a64e8e9e7afbad0760a4b07f965bf83
2012-01-24 11:18:50 -08:00
Jean-Baptiste Queru
38412163da am 70580b20: am 149ae11f: Merge "adb,fastboot: add USB support for Intel Vendor ID"
* commit '70580b20bc8485002df0b3e89e42754c8c9796ff':
  adb,fastboot: add USB support for Intel Vendor ID
2012-01-24 08:49:05 -08:00
Jean-Baptiste Queru
70580b20bc am 149ae11f: Merge "adb,fastboot: add USB support for Intel Vendor ID"
* commit '149ae11fb63818b470156e1652abfad0e08d486d':
  adb,fastboot: add USB support for Intel Vendor ID
2012-01-24 08:42:49 -08:00
Andrew Hsieh
a8748d3b2a am daafb531: am 4779e934: Add Intel\'s vendor ID to adb
* commit 'daafb531484a35a63e229e14d8a81b412e506670':
  Add Intel's vendor ID to adb
2012-01-20 15:52:03 -08:00
Nick Kralevich
5890fe3314 Don't allow adb to run as root in user builds.
Change-Id: I4fbd7beb7f76c68fead1a89b745f0dfb931b4597
2012-01-19 15:06:14 -08:00
Nick Kralevich
bd9206bc73 Move permission checking code to it's own function.
Change-Id: Ibe46ca3043791f3b3815080f9e23ac307b1f5900
2012-01-19 15:02:41 -08:00
Andrew Hsieh
80d50a4c99 am 4779e934: Add Intel\'s vendor ID to adb
* commit '4779e9344bb62208e4772ff6486b6df564f434b8':
  Add Intel's vendor ID to adb
2012-01-19 09:55:28 -08:00
Andrew Hsieh
4779e9344b Add Intel's vendor ID to adb
Change-Id: I81da3ea11bfd44395f6895fe51e477ff1e7fa25b
2012-01-18 14:30:11 -08:00
Wu, Hao
f60e863828 adb,fastboot: add USB support for Intel Vendor ID
This patch adds Intel USB Vendor ID into the support
list for adb and fastboot.

Signed-off-by: Wu, Hao <hao.wu@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
2012-01-17 12:08:06 -08:00
Xavier Ducrohet
a33c6ee92b am e0b55791: am 07ad9f2a: Add USB Vendor ID for Fujitsu and Lumigon.
* commit 'e0b557915123b7ad022ff5d0a7a3d4dd2ee7c2fe':
  Add USB Vendor ID for Fujitsu and Lumigon.
2012-01-11 12:05:16 -08:00
Xavier Ducrohet
95ec1ca903 am 07ad9f2a: Add USB Vendor ID for Fujitsu and Lumigon.
* commit '07ad9f2a127b2836c7d45a503a5f3ef7517218f3':
  Add USB Vendor ID for Fujitsu and Lumigon.
2012-01-11 12:03:32 -08:00
Xavier Ducrohet
07ad9f2a12 Add USB Vendor ID for Fujitsu and Lumigon.
Change-Id: Icd013b362366815527834cbf54aa4ecac2b7750d
2012-01-11 11:55:45 -08:00
Vladimir Chtchetkine
b125671921 am ae429828: Cherry-picked from c4f37eed7 in master. Do not merge.
* commit 'ae4298286896cbef22b2af285a3f651e8f498185':
  Cherry-picked from c4f37eed7 in master. Do not merge.
2012-01-10 16:28:43 -08:00
Vladimir Chtchetkine
9f55988343 am 74159657: Cherry-picked from c13daef7b on master. Do not merge.
* commit '74159657687aadab4c82e4fd7e7a54d16c045d95':
  Cherry-picked from c13daef7b on master. Do not merge.
2012-01-10 16:19:42 -08:00
Vladimir Chtchetkine
ae42982868 Cherry-picked from c4f37eed7 in master. Do not merge.
Fix the build.

Conditionally compile code that is intended to run inside the emulator only.

Change-Id: Ie82e415b2ff52395616f85871dddb38e65b0ed55
2012-01-10 16:19:09 -08:00
Vladimir Chtchetkine
7415965768 Cherry-picked from c13daef7b on master. Do not merge.
Use QEMU pipe for ADB communication when running in emulator.

Change-Id: I7934b6272c2a9825d244ce76ff65dbce6e54ebff
2012-01-10 16:03:17 -08:00
Doug Zongker
447f061da1 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
2012-01-10 10:09:07 -08:00
Christopher Tate
bffa4ca9ad Tell the user to unlock/confirm backup & restore operations
People are being confused about the silent failure of backup/restore
when they didn't know they had to unlock the device & confirm the
backup/restore operation, so now adb prints a brief reminder.

Change-Id: I1b32913f0ad0cf6e30bf235dc975b9e983b533fd
2012-01-06 15:43:03 -08:00
Vladimir Chtchetkine
c4f37eed73 Fix the build.
Conditionally compile code that is intended to run inside the emulator only.

Change-Id: Ie82e415b2ff52395616f85871dddb38e65b0ed55
2011-12-13 12:19:29 -08:00
Vladimir Chtchetkine
c13daef7bd Use QEMU pipe for ADB communication when running in emulator.
Change-Id: I7934b6272c2a9825d244ce76ff65dbce6e54ebff
2011-12-13 08:19:15 -08:00
Christopher Tate
1f4bada667 am 650307df: am b1dfffe6: Fix \'adb backup\' on Windows
* commit '650307df33fc834c251df71c78b00cc0ae6529b7':
  Fix 'adb backup' on Windows
2011-12-12 15:39:07 -08:00
Christopher Tate
1131c1644f am b1dfffe6: Fix \'adb backup\' on Windows
* commit 'b1dfffe6bb506313a3bc9146d2f6f8c533213193':
  Fix 'adb backup' on Windows
2011-12-09 16:55:38 -08:00
Christopher Tate
b1dfffe6bb Fix 'adb backup' on Windows
Use the same call sequence that 'adb pull' uses for creating the
output file.  adb_open_mode() apparently does not work on Windows
hosts.

Bug 5733007

Change-Id: I48d719c4657c93e19f6790cf1c6da610d49f5806
2011-12-09 15:29:30 -08:00
Joe Onorato
ae868a4045 Allow adb to listen both on usb and tcp.
Change-Id: I98db594241631fa17e39686727392afc8b3124bc
2011-12-07 17:50:28 -08:00
Christopher Tate
c6b07d94fa Merge "Tweak logcat parameters" 2011-12-07 16:02:37 -08:00
Christopher Tate
db0a880c46 Tweak logcat parameters
Change-Id: If97ee1eb682d95fa05b5e2003a204a628bd6ae4d
2011-12-07 16:01:59 -08:00
Vladimir Chtchetkine
ce48083fc9 Fixes ADB crash on Windows due to large number of connections. do not merge.
The reason for the crash is that ADB on Windows uses WaitForMultipleObjects to
wait on connection events. When number of connections exceeds 64, ADB crashes,
because WaitForMultipleObjects API doesn't support more than 64 handles. This
CL contains a fixer routine that allows waiting on an arbitrary number of
handles.

(cherry picked from commit ac52833e48)

Change-Id: I8ad264765e5b38d01a31e42b445f97ea86e49948
2011-12-05 13:14:23 -08:00
Vladimir Chtchetkine
ac52833e48 Fixes ADB crash on Windows due to large number of connections.
The reason for the crash is that ADB on Windows uses WaitForMultipleObjects to
wait on connection events. When number of connections exceeds 64, ADB crashes,
because WaitForMultipleObjects API doesn't support more than 64 handles. This
CL contains a fixer routine that allows waiting on an arbitrary number of
handles.

Change-Id: I83f712e552018df308318154c27df184015a16ee
2011-12-01 08:47:35 -08:00
JP Abgrall
61b90bd211 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
2011-11-09 10:30:08 -08:00
Christopher Tate
56885094b6 Add command line help for the new 'adb backup -all -nosystem'
Documentation-only change that supports the new framework-side
feature to omit system packages when you're using adb backup -all.
Bug 5361503.

Change-Id: I86bca8883a7fb8c713ca352ad5980e92fd640d18
2011-10-03 18:27:01 -07:00
Kenny Root
a031a91b95 Skip argument when parsing adb install
A command line flag with an argument was checked in the Pm.java code,
but it wasn't being checked by "adb install" so attempts to use it
failed.

Change-Id: I0b84a4203a416f7323fa823c0f1f1750670d0c76
2011-09-23 13:36:00 -07:00
Xavier Ducrohet
dd52e8c57b Add Positivo's vendor ID to adb.
Change-Id: Ida6fc323d766249f4f12708bae1c50ae5d937b2c
2011-09-16 13:48:50 -07:00
Mike Lockwood
aa61854645 adb: Add USB vendor IDs for K-Touch, Pegatron and Archos
Change-Id: Idbc212abfb7d4d0a53e6b8ecd55134b81f4e960d
Bug: 5182028
Bug: 5157478

Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-09-13 13:20:12 -04:00
Christopher Tate
bb86bc5892 Fix 'adb backup' command line validation
The host side wasn't properly checking for argument-list sufficiency
*after* removing any [-f filename] sequence.

Fixes bug 5164135

Change-Id: I7bc49e37ef168182088e0e664b6897dd2a088ebf
2011-08-22 17:12:08 -07:00
Kenny Root
75ae424629 Merge "Add install arg for verification" 2011-08-16 08:36:17 -07:00
Mike Lockwood
22268c720b am 549bfcda: am 003771d1: am 80d508fd: Merge "correct VID of Lenovo(0x2006 is for LenovoMobile,0x17EF is for Lenovo)"
* commit '549bfcda6df30dd00db254b3717fc8df463ce710':
  correct VID of Lenovo(0x2006 is for LenovoMobile,0x17EF is for Lenovo)
2011-08-15 10:29:03 -07:00
Mike Lockwood
549bfcda6d am 003771d1: am 80d508fd: Merge "correct VID of Lenovo(0x2006 is for LenovoMobile,0x17EF is for Lenovo)"
* commit '003771d1c0ad6c3c6cd0c82f787636111c9e193c':
  correct VID of Lenovo(0x2006 is for LenovoMobile,0x17EF is for Lenovo)
2011-08-15 10:25:47 -07:00
zhangclb
c11f99f40a correct VID of Lenovo(0x2006 is for LenovoMobile,0x17EF is for Lenovo)
Change-Id: I3466fdf7b03cf5da189efe4efb563d09f14b467a
2011-08-15 14:18:02 +08:00
Christopher Tate
de034ec83e Change default backup filename and terminology
We now use "backup.ab" as the default backup archive filename, and no longer
refer to "tar" or "tarfiles" in the help text.  The underlying format may
be tar, but we're certainly not interoperable even with ustar/pax thanks
to our compression & encryption layers and our custom header.

Change-Id: I3e74af96cfc102e94848c969eb36af54304bfd9b
2011-08-09 17:05:29 -07:00
Kenny Root
597ea5b63f Add install arg for verification
Allow "adb install" to transfer the file for the verification argument
to the package manager "pm install" command.

Change-Id: I4834f45019eb1387a5d2b205b53a67e91d5fa67e
2011-08-06 13:19:56 -07:00
Kenny Root
9ff99f6536 Merge "Default to secure mode" 2011-08-05 10:16:21 -07:00
Kenny Root
ff9d3484e6 Default to secure mode
If ro.secure is not set for some reason, default to secure mode.

Change-Id: Id0ce3ea5507a3f9690332fb5a2daef7d3303481d
2011-07-31 09:15:46 -07:00
Nick Kralevich
514b40bafa am 189de0c1: am adabe566: am 810cf41b: Merge "Fixed memory leak when using transport:serial."
* commit '189de0c1f4339abd7b938b4905775163d2a94bbe':
  Fixed memory leak when using transport:serial.
2011-07-29 16:51:35 -07:00
Nick Kralevich
189de0c1f4 am adabe566: am 810cf41b: Merge "Fixed memory leak when using transport:serial."
* commit 'adabe566906aa5e8ce791327559aeb10c139b365':
  Fixed memory leak when using transport:serial.
2011-07-29 16:47:31 -07:00
Nick Kralevich
810cf41b6d Merge "Fixed memory leak when using transport:serial." 2011-07-29 16:32:21 -07:00
Tom Marlin
3175c8e9bf 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>
2011-07-29 13:38:56 -05:00
Mike Lockwood
ea839db289 am b1cfa672: am 7d39463e: am d1015de9: Merge "adb: Add USB vendor ID for Vizio"
* commit 'b1cfa672014d197d6d4d12fca0d40cd59de436bc':
  adb: Add USB vendor ID for Vizio
2011-07-29 06:22:44 -07:00
Mike Lockwood
b1cfa67201 am 7d39463e: am d1015de9: Merge "adb: Add USB vendor ID for Vizio"
* commit '7d39463eff2a9002208f34f1d2ce4d62546f6c3a':
  adb: Add USB vendor ID for Vizio
2011-07-29 06:20:10 -07:00
Mike Lockwood
fb34e98bdd adb: Add USB vendor ID for Vizio
Change-Id: I280ff83d7f1fda1ed811bd42cb6fd65036525559
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-29 08:59:43 -04:00
Mike Lockwood
b32904a9ea am 01acea11: am 1f72fe99: am 7df080b2: am 3ddaa0ad: Merge "adb: Add USB vendor ID for Lenovo"
* commit '01acea112501f7d140f100591319781e59b90d0e':
  adb: Add USB vendor ID for Lenovo
2011-07-18 09:23:23 -07:00
Mike Lockwood
01acea1125 am 1f72fe99: am 7df080b2: am 3ddaa0ad: Merge "adb: Add USB vendor ID for Lenovo"
* commit '1f72fe991dc2e48c13518015c523f9e3ea048af2':
  adb: Add USB vendor ID for Lenovo
2011-07-18 09:18:58 -07:00
Jean-Baptiste Queru
7076831c7d am f75a2ed2: Merge from gingerbread-plus-aosp
* commit 'f75a2ed2138cd8b74597bd57e13d12e1f0b815c2':
  adb: Add vendor IDs for iRiver, Compal and T & A Mobile Phones
  Add Gigabyte's USB vendor ID to adb.
  Add Funai's USB vendor ID to adb.
2011-07-14 10:49:22 -07:00
Mike Lockwood
7c17d0932c adb: Add USB vendor ID for Lenovo
Change-Id: I1c2423f567272493067fae04e64fdcb651b0af62
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-14 09:00:33 -04:00
Jean-Baptiste Queru
f75a2ed213 Merge from gingerbread-plus-aosp
Change-Id: I55b84eda30edf0eade8b43712ab011cd3f65f0d9
2011-07-12 14:41:38 -07:00
Jeff Brown
29e1e7393d Remove the simulator target from all makefiles.
Bug: 5010576

Change-Id: I2fcf31af681d92880e5d31a46d5f6777f7ca1977
2011-07-11 22:12:32 -07:00
Mike Lockwood
292e86230e adb: Add vendor IDs for iRiver, Compal and T & A Mobile Phones
Change-Id: I4dafc43aa76049dd0075e1d70ba05d899e545c8d
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-11 09:39:39 -04:00
Joe Bass
7a5c1463ba Add Gigabyte's USB vendor ID to adb.
Bug #4452872

Change-Id: Ib97548d121d40e96ccc519323a335fc90f3b32b9
2011-07-11 09:39:02 -04:00
Xavier Ducrohet
cbe19cec61 Add Funai's USB vendor ID to adb.
Change-Id: Idc2974d4437ab1c79cfea5aade98b599a877aad3
2011-07-11 09:37:43 -04:00
Mike Lockwood
535164e9d9 Reimplement the "adb root" command to more closely match its previous behavior
The adb gadget driver used to reset the USB bus when the adbd daemon exited,
and the host side adb relied on this behavior to force it to reconnect
with the new adbd instance after init relaunches it.  The new gadget
drivers no longer automatically reset the USB bus when adbd is restarted
which caused adb to hang since it was no longer forced to reconnect with the
device.  We attempted to work around this on the host side adb, but that
work around has not been reliable.

This change adds a property trigger on the service.adb.root system property
which will reset the USB bus and restart the adbd daemon when adbd sets
the property to 1.  This should be much closer to the previous behavior
and will hopefully fix some problems with automated testing.

Change-Id: I177c37400009a3d83f21a5f9431f94fd1cc19b9b
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-22 08:36:53 -04:00
Mike Lockwood
07edefe4ce Revert "adb: kick the transport after sending the "adb root" command"
This reverts commit d15e6ac95d.

Also increment adb version to 1.0.29

Change-Id: I890643f0c18a2fe90f170134df039c54116cecda
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-22 07:15:44 -04:00
Mike Lockwood
693e78b9b6 Merge "Fix hang after end of backup" 2011-06-21 16:44:32 -07:00
Christopher Tate
10f129ca8e Fix hang after end of backup
The buggy behavior was that the 'adb backup ....' host command line
invocation would hang forever, even after the backup finished and
the forked device-side subprocess had been reaped.  The reason for
this is that the device adbd end of the socketpair used to send
the data back from the forked subprocess was still stuck readable
even after the remote end of it had been closed.

With this patch, the thread whose job it is to waitpid() in order
to harvest the forked child process also closes the local (adbd)
end of the socketpair.  This makes the fdevent logic notice that
the socket is dead, at which point it cleans up everything including
the communication back to the host.

Change-Id: I90e7e4e5db36c5a6f7363708b29a6d2c56d1250e
2011-06-21 16:05:17 -07:00
Mike Lockwood
b0bd6024e3 adb: Update version to 1.0.28
Change-Id: Ib8a98d3840abf24cf062112aca7ce462a0f44bc5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-21 17:26:11 -04:00
Christopher Tate
5b811fa5dd Tidy up the end-of-data handling in backup
* Increase transfer buffer size to 32K
* Add logging about error conditions and fd teardown
* Pass the fd number as a command line option to the 'bu' subprocess
* Properly harvest the 'bu' subprocess after it's done

Change-Id: Id44dde25778ecf43c5604fd9d01d726ba58861e5
2011-06-20 16:19:42 -07:00
Kenny Root
b0a8aae3ed Use adb_sleep_ms for Cygwin compat
Change-Id: Iabb2cddfb6740a35e4b6b1563a81b64972c29453
2011-06-15 20:03:49 -07:00
Mike Lockwood
d15e6ac95d 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>
2011-06-12 16:09:27 -04:00
Nick Kralevich
37b9fc6e7c am 4ba5a8ac: am eafcbe10: am 072a0fac: Merge "Fixed adb crash due to accessing freed memory"
* commit '4ba5a8acba033127befd184f2f78cf0580995b07':
  Fixed adb crash due to accessing freed memory
2011-06-09 11:27:11 -07:00
Nick Kralevich
4ba5a8acba am eafcbe10: am 072a0fac: Merge "Fixed adb crash due to accessing freed memory"
* commit 'eafcbe109f97e5a687cc944e65c383fa45d71c8f':
  Fixed adb crash due to accessing freed memory
2011-06-07 16:28:09 -07:00
Tom Marlin
49f1857dd8 Fixed adb crash due to accessing freed memory
Reset peers to NULL after closing them down. This prevents
other code from attempting to access that freed memory
(which prevents crashes). Previously, it left pointers to
freed memory and the "if (s->peer)" guards could not block
the attempt to access that memory later. Resolves many
crashes seen while taking repeated screenshots on WinXP.

Change-Id: I32553f4d19f6ddc9b05b6ab4dc1e9efe69e5be4f
2011-06-03 11:29:17 -05:00
Christopher Tate
c9cd3b9761 Make 'adb backup' -f handling more bulletproof and more flexible
* "adb backup" as the entire command line no longer crashes

* The "-f filename" option can now appear anywhere in the command line.
  A trailing "-f" at EOL prompts an error message and usage summary.

Change-Id: I040ed73c2ca3687e265e35600eb3ab2b3c879695
2011-06-01 17:56:23 -07:00
Joe Bass
2bc503e6a9 am 0efe2f2f: am b27c682e: am f5144d34: Add Gigabyte\'s USB vendor ID to adb.
* commit '0efe2f2f11d79060962f35a3fb4db525d3f12e9e':
  Add Gigabyte's USB vendor ID to adb.
2011-05-21 21:35:49 -07:00
Joe Bass
0efe2f2f11 am b27c682e: am f5144d34: Add Gigabyte\'s USB vendor ID to adb.
* commit 'b27c682e28a01b18f7506a9b35222453058107ad':
  Add Gigabyte's USB vendor ID to adb.
2011-05-20 16:14:13 -07:00
Christopher Tate
5526ee0831 Merge "Add 'adb restore' to parallel 'adb backup'" 2011-05-20 15:36:55 -07:00
Joe Bass
f5144d34fa Add Gigabyte's USB vendor ID to adb.
Bug #4452872

Change-Id: Ib97548d121d40e96ccc519323a335fc90f3b32b9
2011-05-19 11:40:23 -07:00
Xavier Ducrohet
aff5d7870e am 44c336bf: am 830fc9af: am 30d916c3: Add Funai\'s USB vendor ID to adb.
* commit '44c336bfe9bbd400461b9b28a449a67145eaeeb8':
  Add Funai's USB vendor ID to adb.
2011-05-19 08:57:55 -07:00
Xavier Ducrohet
44c336bfe9 am 830fc9af: am 30d916c3: Add Funai\'s USB vendor ID to adb.
* commit '830fc9afbe3e83b3b39278d67a9680bb2068098a':
  Add Funai's USB vendor ID to adb.
2011-05-18 17:41:21 -07:00
Xavier Ducrohet
30d916c360 Add Funai's USB vendor ID to adb.
Change-Id: Idc2974d4437ab1c79cfea5aade98b599a877aad3
2011-05-18 16:57:26 -07:00
Christopher Tate
702967afb1 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
2011-05-17 15:52:54 -07:00
Christopher Tate
024447c3c3 Use the new 'bu' syntax for backup vs restore operation
Change-Id: Ib007705ee562a41869f8add3408101b3a53aa2d7
2011-05-16 16:28:59 -07:00
Omari Stephens
35e6a003ca Merge "Add a 1000msec timeout for adb's USB control packets" 2011-05-16 15:42:26 -07:00
Christopher Tate
574ebc41f8 Merge "Add 'adb backup' for pulling a full backup tarfile to the host" 2011-05-11 12:51:14 -07:00
Omari Stephens
8bbae23915 Add a 1000msec timeout for adb's USB control packets
Includes a version bump to make it possible to determine if a given
binary has this fix or not.

Bug: 4111855
Change-Id: I86d902a7fa0c4b906264141d2467b7bdddb61801
2011-05-09 19:14:24 -07:00
Christopher Tate
d2f5415c60 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
2011-04-27 15:27:23 -07:00
Mike Lockwood
224f9485f1 am 81ce51da: am 55537c34: am 2f7995ee: Merge "adb: fix typo in helptext"
* commit '81ce51dae95deb0dc6b07cbd96bd07d08aad5178':
  adb: fix typo in helptext
2011-04-26 16:06:04 -07:00
Mike Lockwood
81ce51dae9 am 55537c34: am 2f7995ee: Merge "adb: fix typo in helptext"
* commit '55537c347bb31d0e2b176ca2550d2054877f9d54':
  adb: fix typo in helptext
2011-04-26 16:00:55 -07:00
Bernhard Reutner-Fischer
6715a4390f adb: fix typo in helptext
s/ocmmand/command

Change-Id: I4ed17e8df9dc71a28e1caef5a21f6351e92628af
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-04-26 12:53:55 +02:00
JP Abgrall
112445b8a7 adb: Don't allow a forced exit if data is still in the socket
Fixes the  http://b/4271011 "adb shell cat /init.rc output gets truncated"


Change-Id: I6df64374b60789595fb18f96d429315dec032443
Signed-off-by: JP Abgrall <jpa@google.com>
2011-04-12 22:01:58 -07:00
Mike Lockwood
0ffe483a6a am e4bcf830: am d37e0840: Merge "In serial, skip over port as well if numbers found after colon."
* commit 'e4bcf8305748e8799df9047fb0f6881553dd43b5':
  In serial, skip over port as well if numbers found after colon.
2011-04-11 14:55:01 -07:00
Terence Haddock
e994f18c53 In serial, skip over port as well if numbers found after colon.
Change-Id: Icd45f570a9527790eb0cd614a3f77da1a72375b1
2011-04-06 16:18:25 +02:00
JP Abgrall
b40367e7bc adb: keep mac build happy
Use FIONREAD instead of TIOCINQ

Change-Id: Ic9db0228a51c546a798c70f08f2e644a1a376120
2011-03-29 12:36:22 -07:00
JP Abgrall
408fa57864 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
2011-03-28 14:12:22 -07:00
Terence Haddock
28e1390e68 In serial, skip over port as well if numbers found after colon.
Change-Id: Icd45f570a9527790eb0cd614a3f77da1a72375b1
2011-03-16 09:43:56 +01:00
Ken Sumrall
e3aeeb4de3 Try to unmount writable filesystems when rebooting
Ext4 filesystems like to be unmounted before rebooting.  The Android system
doesn't have a traditional Linux init setup, and shutting down the system
was not much more than calling sync(2) and reboot(2).  This adds a new
function to libcutils called android_reboot().  By default, it calls sync()
and then remounts all writable filesystems as read-only and marks them clean.
There is a flag parameter in which the caller can ask for sync() not to be
called, or to not remount the filesystems as read-only.  Then it will call
reboot(2) as directed by the other parameters.  This change also updates
adb, init and toolbox to call the new android_reboot() function.
Fixes bugs 3350709 and 3495575.

Change-Id: I16d71ffce3134310d7a260f61ec6f4dd204124a7
2011-03-10 18:11:46 -08:00
JP Abgrall
0e7c4274c6 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 69c5c4c45b.

Change-Id: I630bf2e04d2ecf0223bd2af4e87136754ff880d3
2011-02-23 18:49:00 -08:00
JP Abgrall
69c5c4c45b 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>
2011-02-18 14:16:59 -08:00
Mathias Agopian
0909af57d5 am c1fbf7c1: fix [3374821] Cannot take screenshot of HC preview
* commit 'c1fbf7c1638cb4f1f139edf74562fcfbaa6f3435':
  fix [3374821] Cannot take screenshot of HC preview
2011-02-09 13:22:39 -08:00
Mathias Agopian
c1fbf7c163 fix [3374821] Cannot take screenshot of HC preview
don't hardcode the pixelformat to RGBA_8888 when taking
screenshots.

Change-Id: I3a76b49275acfce9a2994436f521b76310cd8fb2
2011-02-09 12:56:25 -08:00
Mike Lockwood
67afaad585 am d4894f4b: am 034117e4: Merge changes I8df51128,Ie922b3e7,I31f78419,I7e8df44d,I6067857b,Ifd35587c,Ie8d66740
* commit 'd4894f4be608c28ef0f39c7794ba865ac812dff9':
  Fix adb leaking file descriptors to forked processes
  adb: Fix command-line parser.
  adb: Increase device descriptor buffer size in Linux host USB support
  adb: improve debug traces readability.
  adb: Don't report negative number of bytes after pushing file > 2 gigabytes
  Adding Texas Instruments to the VID list.
  Support an additional alias for 'adb shell.'
2011-02-03 12:59:03 -08:00
Benoit Goby
3b4a0c81c4 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
2011-02-03 15:26:45 -05:00
David 'Digit' Turner
eb5df470e6 adb: Fix command-line parser.
This fixes the command-line parser to accept both "daemon server"
and "server nodaemon". Before the patch, the second string would
ignore the "nodaemon" flag.

Fixes b/2191598

Change-Id: Ie922b3e7bf57a6e334fc448cec33fb340ca6abc4
2011-02-03 15:26:43 -05:00