adb: Add "adb disconnect" command for disconnecting TCP/IP devices.
Also check that device is not already connected in "adb connect"
Change-Id: I5f84b56b63d8c6932f23791cac319fd6bc39d36c
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/adb/commandline.c b/adb/commandline.c
index 411bb82..055aa10 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -106,6 +106,7 @@
" be an absolute path.\n"
" devices - list all connected devices\n"
" connect <host>:<port> - connect to a device via TCP/IP"
+ " disconnect <host>:<port> - disconnect from a TCP/IP device"
"\n"
"device commands:\n"
" adb push <local> <remote> - copy file/dir to device\n"
@@ -853,10 +854,10 @@
}
}
- if(!strcmp(argv[0], "connect")) {
+ if(!strcmp(argv[0], "connect") || !strcmp(argv[0], "disconnect")) {
char *tmp;
if (argc != 2) {
- fprintf(stderr, "Usage: adb connect <host>:<port>\n");
+ fprintf(stderr, "Usage: adb %s <host>:<port>\n", argv[0]);
return 1;
}
snprintf(buf, sizeof buf, "host:%s:%s", argv[0], argv[1]);