summaryrefslogtreecommitdiffstats
path: root/adb/commandline.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-04-05 13:50:44 -0700
committerJosh Gao <jmgao@google.com>2016-04-18 15:46:25 -0700
commit03468c8c509975f2f410b402b2bc211b42aa0ed9 (patch)
treeee6e1e86180a4db8cd12524928eaf6a9c4ec5a04 /adb/commandline.cpp
parentb046e74beff221d96189c4142f42f18730565921 (diff)
downloadcore-03468c8c509975f2f410b402b2bc211b42aa0ed9.tar.gz
core-03468c8c509975f2f410b402b2bc211b42aa0ed9.tar.bz2
core-03468c8c509975f2f410b402b2bc211b42aa0ed9.zip
adb: add reconnect command.
Add reconnect command for debugging. `reconnect` kicks a transport from the host side, `reconnect device` kicks a transport from the device side. They can be used to produce transport errors. Bug: 25935458 Change-Id: I47daa338796b561941e7aba44a51a6dd117d1e98 (cherry picked from commit 1f4ec19e499ba981e4117f647d191603c2713e79)
Diffstat (limited to 'adb/commandline.cpp')
-rw-r--r--adb/commandline.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index 8e76168cb..e635c3c3e 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -239,6 +239,9 @@ static void help() {
" - If it is \"system\", \"vendor\", \"oem\" or \"data\", only the corresponding partition\n"
" is updated.\n"
"\n"
+ "internal debugging:\n"
+ " adb reconnect Kick current connection from host side and make it reconnect.\n"
+ " adb reconnect device Kick current connection from device side and make it reconnect.\n"
"environment variables:\n"
" ADB_TRACE - Print debug information. A comma separated list of the following values\n"
" 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp\n"
@@ -1857,6 +1860,14 @@ int adb_commandline(int argc, const char **argv) {
}
}
return 0;
+ } else if (!strcmp(argv[0], "reconnect")) {
+ if (argc == 1) {
+ return adb_query_command("host:reconnect");
+ } else if (argc == 2 && !strcmp(argv[1], "device")) {
+ std::string err;
+ adb_connect("reconnect", &err);
+ return 0;
+ }
}
usage();