Commit graph

91 commits

Author SHA1 Message Date
Mark Salyzyn
60299dfd6a adb: turn on -Werror
- Deal with some -Wunused issues

Change-Id: Idfd1a114e68ae637978b52fde5144d0dca0ec79f
2014-05-05 10:30:06 -07:00
Mark Lindner
76f2a93b18 Added transfer progress reporting for push and pull commands.
Added a new '-p' switch to the 'push' and 'pull' commands that outputs
the file transfer progress (bytes transmitted, total bytes, and % done).
This provides useful feedback when transferring large files, and also
makes it possible for other tools to easily monitor the progress of a
forked push/pull command.

Change-Id: Iee6f42f5bd41292e5bc80fba779f526f0072e356
2014-03-11 19:31:26 -07:00
Brian Carlstrom
93c91fad77 Improve some adb error logging
Bug: 11290643
Change-Id: Ibad4e9f0b69421cd6017b70a52237e7f27aab848
2013-10-27 16:56:55 -07: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
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
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
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
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
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
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
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
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
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
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
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
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
Christopher Tate
db0a880c46 Tweak logcat parameters
Change-Id: If97ee1eb682d95fa05b5e2003a204a628bd6ae4d
2011-12-07 16:01:59 -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
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
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
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
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
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
574ebc41f8 Merge "Add 'adb backup' for pulling a full backup tarfile to the host" 2011-05-11 12:51:14 -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
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
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
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
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
Daniel Sandler
9c73d17e87 Support an additional alias for 'adb shell.'
Change-Id: Ie8d667407fef8ee5a6c7ab86b30307fb61869170
2011-02-03 15:26:29 -05:00
David 'Digit' Turner
305b4b0f60 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-01-31 14:23:56 +01:00
Daniel Sandler
ff91ab855b Support an additional alias for 'adb shell.'
Change-Id: Ie8d667407fef8ee5a6c7ab86b30307fb61869170
2010-08-19 01:10:18 -04:00
The Android Open Source Project
f7e148c1bc merge from open-source master
Change-Id: I9b051ebd6e785e4d68e148a005a0485e79aa55ea
2010-06-03 09:09:17 -07:00
Mike Lockwood
cbbe79add1 adb connect and disconnect improvements:
Port number is now optional.  Will use default port 5555 if not specified.
"adb disconnect" with no additional arguments will disconnect all TCP devices.

Change-Id: I7fc26528ed85e66a73b8f6254cea7bf83d98109f
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-06-02 11:31:26 -04:00
The Android Open Source Project
456688bfb4 merge from open-source master
Change-Id: I99ae03ba51ee185b9cfecf4f26e94a757f3815c2
2010-06-02 08:14:33 -07:00
Mike Lockwood
67d5358e2a adb: remove obsolete shell history support.
Change-Id: I85a7cda176ca3bb7cb9f96e18556d53daaac3023
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-25 13:40:15 -04:00
The Android Open Source Project
e57d89186d merge from open-source master
Change-Id: Ibc1c58aa757910f2b00acf6883127dd027f01d73
2010-05-03 16:32:46 -07:00
Tim
cd64315f72 Add documentation for some adb environmental variables.
The ADB_TRACE one is particularly important.

Change-Id: I125a5930c43065c8cf505eea40d20e3f209bc858
2010-04-29 07:41:50 -07:00
The Android Open Source Project
9a22c68e86 merge from open-source master
Change-Id: Id824d3427cb4808a8768f14e7b46c0eaf5e02e73
2010-04-28 12:58:12 -07:00
Stefan Hilzinger
a84a42eb20 Make adb's daemon-port on the host machine configurable.
This is the first CL of a somewhat larger effort which, among other things,
will involve changing the emulator and ddms to talk to adb running on a
configurable port.

The port can be configured using environment variable ANDROID_ADB_SERVER_PORT.

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

Change-Id: Ib2f431801f0adcd9f2dd290a28005644a36a780a
2010-04-28 11:38:34 -04:00
Brian Carlstrom
805c4a7030 Add missing newlines to adb usage message 2010-04-28 11:32:53 -04:00