summaryrefslogtreecommitdiffstats
path: root/adb/client/commandline.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2019-03-14 15:38:02 -0700
committerJosh Gao <jmgao@google.com>2019-03-14 15:41:41 -0700
commitd10b7c4e023a707a1ad1ca40524f0abd4cdea8f7 (patch)
treea61da51b3d96be4aff3b8f23cc13d4895aad4350 /adb/client/commandline.cpp
parent9d3310c019839ec342b5c0712f3ba59cfd5ca4a0 (diff)
downloadsystem_core-d10b7c4e023a707a1ad1ca40524f0abd4cdea8f7.tar.gz
system_core-d10b7c4e023a707a1ad1ca40524f0abd4cdea8f7.tar.bz2
system_core-d10b7c4e023a707a1ad1ca40524f0abd4cdea8f7.zip
adb: attempt to exec newer adb servers on Linux.
Test: manual Change-Id: Iebdfa292f21b2871e6010ab6cc964134fec447e9
Diffstat (limited to 'adb/client/commandline.cpp')
-rw-r--r--adb/client/commandline.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/adb/client/commandline.cpp b/adb/client/commandline.cpp
index 3d5d9db32..bb30ae570 100644
--- a/adb/client/commandline.cpp
+++ b/adb/client/commandline.cpp
@@ -1303,9 +1303,9 @@ static void parse_push_pull_args(const char** arg, int narg, std::vector<const c
}
}
-static int adb_connect_command(const std::string& command) {
+static int adb_connect_command(const std::string& command, TransportId* transport = nullptr) {
std::string error;
- unique_fd fd(adb_connect(command, &error));
+ unique_fd fd(adb_connect(transport, command, &error));
if (fd < 0) {
fprintf(stderr, "error: %s\n", error.c_str());
return 1;
@@ -1394,9 +1394,9 @@ int adb_commandline(int argc, const char** argv) {
TransportId transport_id = 0;
while (argc > 0) {
- if (!strcmp(argv[0],"server")) {
+ if (!strcmp(argv[0], "server")) {
is_server = true;
- } else if (!strcmp(argv[0],"nodaemon")) {
+ } else if (!strcmp(argv[0], "nodaemon")) {
no_daemon = true;
} else if (!strcmp(argv[0], "fork-server")) {
/* this is a special flag used only when the ADB client launches the ADB Server */
@@ -1433,11 +1433,11 @@ int adb_commandline(int argc, const char** argv) {
if (*id != '\0') {
error_exit("invalid transport id");
}
- } else if (!strcmp(argv[0],"-d")) {
+ } else if (!strcmp(argv[0], "-d")) {
transport_type = kTransportUsb;
- } else if (!strcmp(argv[0],"-e")) {
+ } else if (!strcmp(argv[0], "-e")) {
transport_type = kTransportLocal;
- } else if (!strcmp(argv[0],"-a")) {
+ } else if (!strcmp(argv[0], "-a")) {
gListenAll = 1;
} else if (!strncmp(argv[0], "-H", 2)) {
if (argv[0][2] == '\0') {
@@ -1569,6 +1569,10 @@ int adb_commandline(int argc, const char** argv) {
}
std::string query = android::base::StringPrintf("host:%s%s", argv[0], listopt);
+ std::string error;
+ if (!adb_check_server_version(&error)) {
+ error_exit("failed to check server version: %s", error.c_str());
+ }
printf("List of devices attached\n");
return adb_query_command(query);
}