summaryrefslogtreecommitdiffstats
path: root/adb/commandline.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Improve adb install help.Svetoslav2015-06-011-0/+7
| | | | | Bug: 21365060 Change-Id: I0a4ea5cf3a2f37a82161b30f7eec5781d175aa8f
* Document the -g option to adb install.Lorenzo Colitti2015-05-281-2/+3
| | | | Change-Id: I012165df343c24953f1c1cfcdce379bf1b67c624
* Fix "adb remount" for devices without an oem partition.Elliott Hughes2015-05-081-22/+15
| | | | | | | | | | | | | | | | On a device without an oem partition, we now have an /oem directory anyway. This causes find_mount to fail, and that was returning nullptr from a std::string-returning function. Boom! Also clean up the bits of code I had to trace through between "adb remount" on the host to the crash on the device as I debugged this. The only other meaningful change is the error checking in adb_connect_command --- adb_connect can also return -2. Bug: http://b/20916855 Change-Id: I4c3b7858e13f3a3a8bbc7d30b3c0ee470bead587 (cherry picked from commit 5677c23e8d0c085be8d8429a5d125147d11e9bb2)
* Try to include the SHA in a ddmslib-compatible way.Elliott Hughes2015-05-081-2/+2
| | | | | | Bug: http://b/20918202 Change-Id: I0c1a48459372b0d28aaf9d09d82540e44b438c9c (cherry picked from commit f3bbfa6a216669c4cd91d5f936662e89e0ae07ca)
* Include the git sha in the adb version.Dan Albert2015-05-061-2/+2
| | | | | | | Also add --version to adbd to display the same thing. Change-Id: I47dfbad16c892c42ea938aedd085ba77492791ba (cherry picked from commit 1ba1d7c1ee644967ff4743b0d257290cbeca7a83)
* Implement the ssh(1) escaping rules.Elliott Hughes2015-05-051-70/+39
| | | | | | | | | | | | | | | The first rule of ssh(1) escaping is that there is no escaping. This doesn't undo any of my recent security fixes because they're all calling escape_arg themselves. This fixes "adb shell rm /data/dalvik-cache/arm/*". Also remove do_cmd which caused concern during code review. Bug: http://b/20564385 Change-Id: I4588fd949d51e2a50cff47ea171ed2d75f402d0d (cherry picked from commit 2b10111d25adcfe3627103b73edad22f188c97ba)
* Add WriteFdFmt and clean up more code.Elliott Hughes2015-05-011-17/+12
| | | | | | | | Also say *which* device wasn't found. Bug: http://b/20666660 Change-Id: I50e234ad89e39ae0a8995083c0b642c61275c5a3 (cherry picked from commit ab52c181fa4c1c9891644635dc5653cda5b90e2b)
* More adb buffer fixes.Elliott Hughes2015-05-011-11/+2
| | | | | | | | | | | | | | This patch factors out a lot of the basic protocol code: sending OKAY, sending FAIL, and sending a length-prefixed string. ADB_TRACE has been non-optional for a long time, so let's just remove the #ifs. Also actually build the device tracker test tool (and remove its duplicate). Bug: http://b/20666660 Change-Id: I6c7d59f18707bdc62ca69dea45547617f9f31fc6 (cherry picked from commit e67f1f87d9b1188ec8617035db7006c37ee7b21e)
* More fixed-length buffer removal.Elliott Hughes2015-04-301-148/+64
| | | | | | Bug: http://b/20666660 Change-Id: I0c738e9fed2defed48a9cf2d0a4f7b99c08dcf3d (cherry picked from commit 6452a89aa8934231e12ab77e0d90f12c3e892ad1)
* Move __adb_error to std::string, and improve various errors.Elliott Hughes2015-04-291-76/+90
| | | | | | | | | | Also remove an sprintf. Also fix various bits of code that were reporting stale adb_error values when they meant strerror. (cherry-pick of 078f0fcf4c63b8d8e8c10a18855eae04ca321e06.) Bug: http://b/20666660 Change-Id: Ibeb48b7bc21bb0ec30ba47889d1d671ee480e1b7
* Merge "Add missing null checks after allocations."Elliott Hughes2015-04-221-0/+6
|\
| * Add missing null checks after allocations.Elliott Hughes2015-04-211-0/+6
| | | | | | | | | | Bug: http://b/20317729 Change-Id: I62bb761d48ee59a1f4ddd0cdd0632432305ca2ca
* | Plumb more of the error reporting through.Elliott Hughes2015-04-211-7/+4
|/ | | | | | | | | This doesn't fix the bug, but it does flatten the bug to the well-known and long-standing "adb shell" doesn't return exit statuses, so when we fix that, this one will fix itself. Bug: http://b/20423886 Change-Id: I48351e46f05dd3f2f6e57f0df1d851333458d0ef
* Fix "adb sync" for devices without vendor and oem.Elliott Hughes2015-04-211-22/+16
| | | | | Bug: http://b/20440110 Change-Id: I2481992198890f5ca50412c2b7ca361101961413
* Fix the Windows adb build.Elliott Hughes2015-04-191-0/+10
| | | | | | | | | | It looks like we can't use clang on Windows yet because libc++ isn't ready. So move back to GCC for the Windows host clang. Work around the mingw printf format string problems that made us want to switch to clang in the first place, and #include "sysdeps.h" in adb_utils.cpp to work around the absence of lstat(2) on Windows. Change-Id: Icd0797a8c0c2d1d326bdd704ba6bcafcbaeb742f
* Use escape_arg in "adb backup".Elliott Hughes2015-04-171-26/+18
| | | | | | | | This doesn't fix the injection vulnerability, but it makes "adb backup" no worse than the other commands, and lets me fix them all at once. Bug: 20323053 Change-Id: I39843c065d9d738b6b7943b2ffd660e4a031cc36
* Remove yet more fixed-length buffers (and their overruns).Elliott Hughes2015-04-171-84/+12
| | | | | Bug: 20317724 Change-Id: If137fc96f5f23576ccecd388ac87afefa47337c6
* Merge "Fix more buffer overruns."Elliott Hughes2015-04-171-217/+107
|\
| * Fix more buffer overruns.Elliott Hughes2015-04-171-217/+107
| | | | | | | | | | | | | | Also add some tests. Bug: 20323050 Change-Id: I9eaf3dc04efd85206663c4cca4f8c1208620a89a
* | Use PRI* macros to fix the Windows build.Elliott Hughes2015-04-171-4/+6
|/ | | | Change-Id: Icd400be05c2bc726265832875b5a05dba7966847
* Remove various fixed-length buffers (and their overflows).Elliott Hughes2015-04-171-110/+58
| | | | | | | | | | Bug: 20323052 Bug: 20323051 Bug: 20317728 Bug: 20317727 Bug: 20317726 Bug: 20317725 Change-Id: I57a5e30a5b7867715f55cee7429aa36d7ce21484
* Move sysdeps_win32 to C++.Elliott Hughes2015-04-161-3/+1
| | | | Change-Id: I27ca41b64d62bb3611b3a39a5c3bb4377d0773bc
* Disable CR/LF translation for adb interactive shell.Alistair Buxton2015-04-051-14/+10
| | | | | | | | | | | | | adb shell uses termios to disable canonical input processing in order to get raw control codes but it does not disable CR/LF translation. The default for Linux terminals is to convert CR to LF unless the running program specifically asks for this to be disabled. Since adb does not, there is no way to send a CR to any program run on adb shell. Many programs do in fact differentiate and so are broken by this behaviour, notably nano. This patch sets the termios flags to disable all line ending translation. Change-Id: I8b950220f7cc52fefaed2ee37d97e0789b40a078 Signed-off-by: Alistair Buxton <a.j.buxton@gmail.com>
* adb: Add option to reboot into sideload mode in recoveryTao Bao2015-03-311-20/+21
| | | | | | | | | | | | | | | | Currently it requires manual key press to enter the sideload mode. This CL adds 'adb reboot sideload' to reboot the device into sideload mode directly with text display on. With 'adb reboot sideload-auto-reboot', it will reboot after the sideload regardless of the installation result, unless interrupted by user. Since it needs to write to /cache/recovery/command file, 'adb root' is required before calling 'adb reboot sideload' and the one with '-auto-reboot'. Also it requires the matching CL in bootable/recovery. Change-Id: Ib7bd4e216a1efc01e64460659c97c6005bbaec1b
* adb shell: Win32: fix Ctrl-C, tab completion, line editing, server echoSpencer Low2015-03-261-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The 'adb shell' command on Windows has had problems: * Ctrl-C killed the local Windows adb.exe process instead of sending the Ctrl-C to the Android device. * Local echo was enabled, causing everything typed to be displayed twice. * Line input was enabled, so the Android device only received input after hitting enter. This meant that tab completion did not work because the tab wasn't seen by the shell until pressing enter. * The usual input line editing keys did not work (Ctrl-A to go to the beginning of the line, etc.). This commit fixes these issues by reconfiguring the Win32 console and then translating input into what Gnome Terminal would send, in effect somewhat emulating a Unix terminal. This does not fix all Win32 console issues, but is designed to be better than what we had before, and to make the common day-to-day usage much more comfortable and usable. Change-Id: Idb10e0b634e27002804fa99c09a64e7176cf7c09 Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
* File header cleanup.Dan Albert2015-03-191-3/+4
| | | | | | | | | * sysdeps.h should always be included first. * TRACE_TAG needs to be defined before anything is included. * Some files were missing copyright headers. * Save precious bytes on my SSD by removing useless whitespace. Change-Id: I88980e6e00b5be1093806cf286740d9e4a033b94
* Revert "Revert "adb: support /oem partition""Elliott Hughes2015-03-161-25/+42
| | | | | | | | | | This reverts commit 6084a0124f868c7ec43f6c415a27a168f27ff694. The original build breakage is fixed by (a) building the verity code for eng builds as well as userdebug builds and (b) moving the exported remount service functions into a new header file. Change-Id: Ice0c4f97d4db38ab7eb333c7a6e56bbd11123f5b
* Revert "adb: support /oem partition"Dan Albert2015-03-161-42/+25
| | | | | | | | This is broken on userdebug builds, and it isn't completely clear why. The declaration for make_block-device_writable in adb.h wasn't updated to match the definition (which uses a std::string instead of a char*). adb.h is currently extern "C", and it isn't clear why this is only broken for userdebug, so I'd like to revert while we investigate. This reverts commit 81416fdb186070fe4db3ca5fed2e713a4eecaac1. Change-Id: I47f321574f9f21052e2c7332e8b0f6ef9ab98277
* adb: support /oem partitionMÃ¥rten Kongstad2015-03-161-25/+42
| | | | | | Add support for /oem partition in commands 'adb remount' and 'adb sync'. Change-Id: I5defc74ccaa37feaef74b9268e22b4075f98a59f
* Move adb to C++.Dan Albert2015-03-091-0/+2065
I keep trying to clean things up and needing std::strings. Might as well just do this now. usb_linux_client.c is going to stay as C because GCC isn't smart enough to deal with the designated initializers it uses (though for some reason it is in C mode). The Darwin files are staying as C because I don't have a way to test that they build. The Windows files are staying as C because while I can actually build for them, it's slow and painful. Change-Id: I75367d29205a9049d34460032b3bb36384f43941