WA: Fix adb wait-for-device command

Without -s argument, adb wait-for-device will make a call to
acquire_one_transport() with sinfo->serial.c_str() == "".
Waiting for acquire_one_transport() to be reworked to use std::string
rather than const char * for serial, work around this by passing NULL
when sinfo->serial is not initialized in host_service_to_socket().

Change-Id: Ifef53e0e82850364f5029ee36560376f2a4a5104
Signed-off-by: Leo Sartre <leox.sartre@intel.com>
This commit is contained in:
Leo Sartre 2016-01-05 12:06:05 +01:00
parent 100001a537
commit 94e0776eb8
1 changed files with 3 additions and 2 deletions

View File

@ -368,8 +368,9 @@ static void wait_for_state(int fd, void* data) {
while (true) {
bool is_ambiguous = false;
std::string error = "unknown error";
atransport* t = acquire_one_transport(sinfo->transport_type, sinfo->serial.c_str(),
&is_ambiguous, &error);
const char* serial = sinfo->serial.length() ? sinfo->serial.c_str() : NULL;
atransport* t = acquire_one_transport(sinfo->transport_type, serial, &is_ambiguous, &error);
if (t != nullptr && t->connection_state == sinfo->state) {
SendOkay(fd);
break;