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
diff --git a/adb/adb.cpp b/adb/adb.cpp
index cb54d04..e0c0503 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -1134,6 +1134,13 @@
/* we don't even need to send a reply */
return 0;
}
+
+ if (!strcmp(service, "reconnect")) {
+ if (s->transport != nullptr) {
+ kick_transport(s->transport);
+ }
+ return SendOkay(reply_fd, "done");
+ }
#endif // ADB_HOST
int ret = handle_forward_request(service, type, serial, reply_fd);