summaryrefslogtreecommitdiffstats
path: root/adb/commandline.c
Commit message (Collapse)AuthorAgeFilesLines
* Test readx/writex (now renamed).Dan Albert2015-02-251-6/+6
| | | | | | | | | | | | | | Renamed readx/writex to ReadFdExactly/WriteFdExactly respectively. These read/write a full fixed-size buffer. If the whole buffer cannot be read/written, these functions return an error. Rename write_string to WriteStringFully. Move the TEMP_FAILURE_RETRY definition in sysdeps.h out of the !Windows section. It seems Windows won't actually interrupt a call, but it's easier to just define it than to #ifdef each call. Change-Id: Ia8ddffa2a52764a2f9a281c96c937660e002b9b9
* Move transport declarations into transport.h.Dan Albert2015-02-241-10/+11
| | | | | | There are a few cloexec issues in here as an added bonus. Change-Id: I1699d719d733f47878bdba0454230cf5ab6a60b6
* adb: add "adb unroot" to restart adb in non-root modeDan Pasanen2015-02-181-0/+2
| | | | Change-Id: Ice6b94a71a62648ac073d129914a07372411fb25
* adb: Win32: set socket buffer sizes properlySpencer Low2015-01-261-2/+2
| | | | | | | | | | | | | | | | | | On Windows, adb_socket_setbufsize() was taking a file descriptor value from the compatibility layer in sysdeps_win32.c (namely, an index into the _win32_fhs array) and passing it to the Winsock setsockopt() call, which wants a Winsock SOCKET handle. Basically, adb_socket_setbufsize() was passing `fd` instead of `_fh_from_int(fd)->fh_socket`, resulting in adb effectively setting a socket buffer size on a random socket in the process. The fix is to introduce adb_setsockopt() which just calls setsockopt() on non-Win32, and which uses the Winsock SOCKET handle on Win32. The change also moves Win32 disable_tcp_nagle() to a header and adds an extra sanity check to adb_shutdown(). Change-Id: I4354e818d27538f7ff5b0e70b28bdb6300e1b98b Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
* adb: Fix 'adb forward --no-rebind'.David 'Digit' Turner2015-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Due to a typo, the --no-rebind option never worked (it always failed). The root of the problem was that the client was sending on the wire a command like: host:forward:norebind::tcp:<port>;tcp:<port> ^^ Instead of: host:forward:norebind:tcp:<port>;tcp:<port> ^ Note the erroneous double-column. The fix is local to the adb client and thus doesn't require a new version of the server or guest adbd on the device-side. This also fixes 'adb reverse --no-rebind'. See https://code.google.com/p/chromium/issues/detail?id=451109 Change-Id: I680fd432b5470072f6a9968ca32a7f90c600ac68
* Fix some style issues in adb_commandline().Riley Andrews2014-12-091-27/+27
| | | | Change-Id: I8ed7899e7e137405594b3f3cbb0a87eae411dfc9
* Refactor the host adb argument parsing loop to remove a gotoRiley Andrews2014-12-091-101/+70
| | | | Change-Id: I3412ac473abc4efa51a6275658e65f7191b5439d
* Add adb enable-verityPaul Lawrence2014-12-091-2/+4
| | | | | | | | | | | Note that it is *easy* to break your phone with this feature. It is not a bug that reenabling verity after changing one byte of the system partition stops the device booting. (cherry-pick of 7c442e1700e6312727283db402dec6f666f1b55a.) Bug: 18529433 Change-Id: I632e91281884471a362960f1ba30312d2669b8ff
* Revert "Revert "Enable verity on userdebug, and add disable-verity to adb""Paul Lawrence2014-12-091-3/+3
| | | | | | | | | | | This reverts commit 152d2d4234ba89e0c20c4af13e291b6049a7bc33. Fixed build error, and also fixed memory leak spotted from warning. (cherry-pick of bbb36319119edde9377fb80015235893c30d2bc9.) Bug: 17691572 Change-Id: I23b5ba537f7b557432041d4338b38b9be434e981
* Introduce "adb keygen"Nick Kralevich2014-12-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | | Introduce the "adb keygen" command. Usage: adb keygen <filename> This command creates an adb public/private key pair in a user specified file. This can be used to create new adb keys, or rotate existing keys. Modify adb's key generation routines to use the HOSTNAME/LOGNAME environment variables if available. This allows someone to override the username/hostname embedded within the adb public key file if desired. Fallback to the old mechanisms if those environment variables aren't available. Bug: 18342715 Change-Id: Ibccee6088d4609aa05ad6687d3a1d8a8689d3e8a (cherry picked from commit af782b9f2ac4fb817ded80d4317a45345bb3f992) Change-Id: Ic76ffc9412171dddc879af0bbf6e20fbe1a8f057
* kill HAVE_TERMIO_HYabin Cui2014-11-171-12/+17
| | | | | Bug: 18398307 Change-Id: Idbb89a074cdf16869cae3f667e89472781f37a5f
* kill HAVE_FORKEXECYabin Cui2014-11-121-2/+2
| | | | | Bug: 18317407 Change-Id: I4eecb3c9d745e3dabfc46fa595aac7f94f6d93e3
* Remove obsolete reference to ddk; Fixes for -WerrorAndrew Hsieh2014-09-301-0/+1
| | | | | | | | | | | | | | | | Bug: 14416410 1. The new mingw-w64 toolchain x86_64-w64-mingw32-4.8 has ddk in x86_64-w64-mingw32/include/ddk 2. Add -Wno-error=cpp to suppress a warning that turns into error thanks to -Werror: Please include winsock2.h before windows.h 3. Cast GetLastError() return type DWORD to "int" 4. Include direct.h for _mkdir 5. Include stdint.h for uint8_t on Windows Change-Id: I4bec0587f6573692f08c760da6c98ae551b8b5eb
* delete_file() should force removal.Jeff Sharkey2014-09-091-1/+1
| | | | | | | | It's a shell command with a pty, but it's not really interactive, so force the removal to avoid giving users dead-end prompts. Bug: 17339227 Change-Id: Iaf5d95c49f032066aa741a711a2c45557d93c598
* Fix build of adb with gcc-4.9.Alexander Ivchenko2014-08-061-2/+5
| | | | | | | | | | | | | Without this patch we get: system/core/adb/commandline.c:1629:16: error: array subscript is above array bounds [-Werror=array-bounds] Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com> (cherry picked from commit 53723338858772a0189aa3f92f4d4bbdaa9b6772) Change-Id: I920c1de933ce5ba0a0d57eb8a9b557325a767a2a
* Fix Windows adb build by avoiding "bool"Brian Carlstrom2014-08-051-1/+1
| | | | Change-Id: I9ca59e400c199d497a1a18d5e64c2cafe628097b
* Escape single quotes in arguments.Jeff Sharkey2014-08-051-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Verified that these use-cases continue working: $ adb shell arg a a 'b b' $ adb shell arg a a "b b" |arg|a|a|b b| $ adb shell arg "a a 'b b'" |arg|a a 'b b'| $ adb shell arg 'a a "b b"' |arg|a a "b b"| $ adb shell arg a\"b\'c |arg|a"b'c| $ adb shell "arg a && arg b" |arg|a| |arg|b| $ adb shell "arg 'a' \"b\" c" |arg|a|b|c| Bug: 16139781 Change-Id: I3b010b6cdf57281695c11fda318c9bea0a7221cc
* Follow refactoring of install-abandon command.Jeff Sharkey2014-07-251-2/+2
| | | | | Bug: 16543552 Change-Id: I1f54254813fd7d7f4341b8815f816535a39de079
* Fix the build in clangChristopher Tate2014-07-141-4/+4
| | | | | | | "fprintf(stderr, buf)" is a warning in some compilers, and we're building with all warnings promoted to error. Change-Id: Ie3c6ddcd74cf4dda40cf7b742df955dde1d1a5ff
* Fix 64-bit builds.Jeff Sharkey2014-07-141-1/+1
| | | | Change-Id: I1ff5c9c3dc8d870aef2885f8a1989c6c913ccb3d
* Add install-multiple to adb.Jeff Sharkey2014-07-141-90/+185
| | | | | | | | | | | | | | | | | | | The new install-multiple command automates creating an install session, streaming multiple files into place, and then committing or destroying the session. This uses the recent "exec" feature to stream APK contents over stdin directly into their final resting place, requiring no extra copies. Blindly pass through command line arguments to "pm" to make adding new flags easier in future. Remove support for verifying APK before sending across wire, since it was reading the entire APK into memory (!) before sending. Also remove encrypted APKs, since they are no longer supported. Drop support for undocumented verification files. Bug: 14975160 Change-Id: I0c538471873061798160e2e47cec4c0424c27361
* fix windows buildDoug Zongker2014-07-071-1/+1
| | | | Change-Id: Ia7b236f1a915630fe85d488072efb9784ba10dad
* adb: fix 64-bit buildColin Cross2014-07-071-1/+1
| | | | | | | strlen returns a size_t, but the * modifier in printf expects an int. On arm64 size_t != int. Change-Id: I11e84a7b62c935162abc0aba910d14e63d11efd3
* Merge "add sideload-host mode to adb"Doug Zongker2014-07-071-1/+110
|\
| * add sideload-host mode to adbDoug Zongker2014-07-071-1/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | The sideload-host mode turns the host into a server capable of sending the device various pieces of the file on request, rather than downloading it all in one transfer. It's used to support sideloading OTA packages to devices without the need for them to hold the whole package in RAM. If the connected device doesn't support sideload-host mode, we fall back to the older sideload connection. Change-Id: I5adaedd8243dc3b76414bba0149879ca2bbf35fa
* | Added support for vendor partition to adbDaniel Rosenberg2014-07-021-14/+26
|/ | | | | | | | | Remount will now remount the vendor partition as well, if it exists. Sync will also allow you to sync vendor, and will include it by default if it exists. Change-Id: Iea1e8212f445e96233438a8d8a9d3266bf3d6557 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* Partially revert argument escaping.Jeff Sharkey2014-06-111-13/+20
| | | | | | | | Commands chained with && need to be passed through literally instead of always being quoted. Bug: 15479704 Change-Id: I2998e40a92a3bfd092098cd526403b469c86c9a6
* Uniformly escape shell arguments.Jeff Sharkey2014-06-101-40/+25
| | | | | | | | | Arguments with embedded spaces need to be wrapped in quotes, which changes the overall escaping strategy. Instead of mixing the two strategies, just always wrap arguments in quotes. Bug: 15479704 Change-Id: I03eacfa1bd6c220d4ec6617b825ebb0c43c7221e
* am 7cf8e1cb: am 4e26c95a: Merge "Skip the "--abi" flag on "adb install" if ↵Narayan Kamath2014-06-031-0/+2
|\ | | | | | | | | | | | | present." * commit '7cf8e1cb88c44963ccb2128113d8a804d85645b9': Skip the "--abi" flag on "adb install" if present.
| * am 4e26c95a: Merge "Skip the "--abi" flag on "adb install" if present."Narayan Kamath2014-06-031-0/+2
| |\ | | | | | | | | | | | | * commit '4e26c95a6363da4885bb9178c9d42c273b357043': Skip the "--abi" flag on "adb install" if present.
| | * Skip the "--abi" flag on "adb install" if present.Narayan Kamath2014-05-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This flag needs to be passed through to the package manager. Without this change, the argument to this flag is interpreted as a filename. NOTE: If we don't want to add special treatment for this flag, we'll have to assume that all flags with a -- prefix have an argument, and that isn't necessarily true. Change-Id: I78c3fa842bc24148d83d7278e6dee395686240a0
* | | Merge "Add "exec" service: shell commands with no pty."Jeff Sharkey2014-06-021-15/+57
|\ \ \
| * | | Add "exec" service: shell commands with no pty.Jeff Sharkey2014-05-301-15/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To facilitate device scripts that want to read/write binary data from the host side, this change introduces a new "exec" service that behaves like "shell" but without creating a pty, which would otherwise mangle binary data. After forking, it hooks up stdin/stdout of the child process to the socket connected through to the host. The adb transport doesn't support shutdown(), so the host can't half-close the socket and wait for device termination. Instead, the host side now has two explicit commands "exec-in" and "exec-out" for either sending or receiving data. Teach host side copy_to_file() to deal with stdin/stdout special cases. Switch device side backup/restore services to use the new create_subproc_raw under the hood. Change-Id: I5993049803519d3959761f2363037b02c50920ee
* | | | am 97267755: am c3358875: am 6e7343b8: Merge "adb: implement "adb reverse ↵David 'Digit' Turner2014-05-271-9/+29
|\ \ \ \ | |/ / / |/| / / | |/ / | | | | | | | | | <local> <remote>"" * commit '972677557bd2c3a0678a945765783e85c7ec7b9c': adb: implement "adb reverse <local> <remote>"
| * | am c3358875: am 6e7343b8: Merge "adb: implement "adb reverse <local> <remote>""David 'Digit' Turner2014-05-271-9/+29
| |\ \ | | |/ | | | | | | | | | * commit 'c3358875169b920847a72428f4e8b8f09f7bdf05': adb: implement "adb reverse <local> <remote>"
| | * adb: implement "adb reverse <local> <remote>"David 'Digit' Turner2014-05-271-9/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the logical opposite of 'adb forward', i.e. the ability to reverse network connections from the device to the host. This feature is very useful for testing various programs running on an Android device without root or poking at the host's routing table. Options and parameters are exactly the same as those for 'adb forward', except that the direction is reversed. Examples: adb reverse tcp:5000 tcp:6000 connections to localhost:5000 on the device will be forwarded to localhost:6000 on the host. adb reverse --no-rebind tcp:5000 tcp:6000 same as above, but fails if the socket is already bound through a previous 'adb reverse tcp:5000 ...' command. adb reverse --list list all active reversed connections for the target device. Note: there is no command to list all reversed connections for all devices at once. adb reverse --remove tcp:5000 remove any reversed connection on the device from localhost:5000 adb reverse --remove-all remove all reversed connections form the current device. Reversed connections are tied to a transport, in other words, they disappear as soon as a device is disconnected. Simple testing protocol: adb forward tcp:5000 tcp:6000 adb reverse tcp:6000 tcp:7000 nc -l localhost 7000 in another terminal: echo "Hello" | nc localhost 5000 Will print "Hello" on the first terminal. Change-Id: I761af790cdb06829b68430afa4145a919fa0e6d5
* | | am e7597115: am 328746da: am 129e9dad: Merge changes ↵Mark Salyzyn2014-05-081-4/+4
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | Idfd1a114,If725a1cb,I61211165,If9a05ccb * commit 'e75971157c46a0fc57194a75d4dde0920f60f427': adb: turn on -Werror netcfg: turn on -Werror mkbootimg: turn on -Werror gpttool: turn on -Werror
| * | am 328746da: am 129e9dad: Merge changes Idfd1a114,If725a1cb,I61211165,If9a05ccbMark Salyzyn2014-05-071-4/+4
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | * commit '328746da8090a549e432da2358585b101e30d753': adb: turn on -Werror netcfg: turn on -Werror mkbootimg: turn on -Werror gpttool: turn on -Werror
| | * adb: turn on -WerrorMark Salyzyn2014-05-051-4/+4
| | | | | | | | | | | | | | | | | | - Deal with some -Wunused issues Change-Id: Idfd1a114e68ae637978b52fde5144d0dca0ec79f
* | | adb: added support for adb pull -a to preserve time stamps and modeLajos Molnar2014-05-021-8/+18
|/ / | | | | | | | | | | | | | | | | | | Added -a flag to adb pull that preserves time and mode. Mode is subjected to umask for security. We only receive modification time from adb server, so creation time will be set to the modification time as well. Change-Id: I37c0b94741ed464f19025d25dea3ff2f6ac43e7f Signed-off-by: Lajos Molnar <lajos@google.com>
* | am a77bef47: Document the adb install -d option.Jeff Brown2014-04-151-1/+2
|\ \ | |/ |/| | | | | * commit 'a77bef47decf2c0818397aced983999e235aa82f': Document the adb install -d option.
| * Document the adb install -d option.Jeff Brown2014-04-151-1/+2
| | | | | | | | Change-Id: Ife0da42c22e4408dc5c07ac0f20e0ecbbde20832
* | Added transfer progress reporting for push and pull commands.Mark Lindner2014-03-111-12/+50
|/ | | | | | | | | | 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
* Improve some adb error loggingBrian Carlstrom2013-10-271-1/+1
| | | | | Bug: 11290643 Change-Id: Ibad4e9f0b69421cd6017b70a52237e7f27aab848
* DO NOT MERGE - Document new -obb flag for adb backupChristopher Tate2013-03-081-1/+4
| | | | | | | | Now that adb backup handles OBB file backup/restore. (Cherrypicked) Change-Id: Ie92b546e3898b62d74f552ab577b7756ad176ee6
* Fix issues where the filename is referred to as 'sideload'Magnus Eriksson2013-03-051-4/+4
| | | | | | | | 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>
* Support adb client connect to remote serverMatt Gumbel2013-01-041-2/+42
| | | | | | | | | | | | | | | | | | 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>
* adb: Improve ADB's forward redirection management.David 'Digit' Turner2012-11-261-5/+82
| | | | | | | | | | | | | | | | 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
* am 42900c30: am 0874aa0e: Merge "adb: Pick desired product value from ↵Jean-Baptiste Queru2012-08-201-1/+1
|\ | | | | | | | | | | | | command line it follows -p" * commit '42900c30cf39ea4cdc41cc3671584b7f4f39b8bc': adb: Pick desired product value from command line it follows -p
| * Merge "adb: Pick desired product value from command line it follows -p"Jean-Baptiste Queru2012-08-201-1/+1
| |\