Show $ADB_VENDOR_KEYS if authentication fails.
Incorrectly set $ADB_VENDOR_KEYS is the most likely cause of failed
adb connections. Make it easier to debug such problems by including
the value in use in the error message.
Bug: 20165551
Change-Id: I64c1d98ae6d3fb40eea9e1f0ddcfcf4f2d9d7318
diff --git a/adb.cpp b/adb.cpp
index ad85184..b09e853 100644
--- a/adb.cpp
+++ b/adb.cpp
@@ -838,10 +838,10 @@
}
}
- const char* err;
- transport = acquire_one_transport(CS_ANY, ttype, serial, &err);
+ std::string error_msg;
+ transport = acquire_one_transport(CS_ANY, ttype, serial, &error_msg);
if (!transport) {
- sendfailmsg(reply_fd, err);
+ sendfailmsg(reply_fd, error_msg.c_str());
return 1;
}
@@ -910,14 +910,14 @@
serial = service;
}
- const char* error_string = "unknown failure";
- transport = acquire_one_transport(CS_ANY, type, serial, &error_string);
+ std::string error_msg = "unknown failure";
+ transport = acquire_one_transport(CS_ANY, type, serial, &error_msg);
if (transport) {
s->transport = transport;
adb_write(reply_fd, "OKAY", 4);
} else {
- sendfailmsg(reply_fd, error_string);
+ sendfailmsg(reply_fd, error_msg.c_str());
}
return 1;
}
@@ -975,7 +975,7 @@
if(!strncmp(service,"get-serialno",strlen("get-serialno"))) {
const char *out = "unknown";
transport = acquire_one_transport(CS_ANY, ttype, serial, NULL);
- if (transport && transport->serial) {
+ if (transport && transport->serial) {
out = transport->serial;
}
send_msg_with_okay(reply_fd, out, strlen(out));
@@ -984,7 +984,7 @@
if(!strncmp(service,"get-devpath",strlen("get-devpath"))) {
const char *out = "unknown";
transport = acquire_one_transport(CS_ANY, ttype, serial, NULL);
- if (transport && transport->devpath) {
+ if (transport && transport->devpath) {
out = transport->devpath;
}
send_msg_with_okay(reply_fd, out, strlen(out));