summaryrefslogtreecommitdiff
path: root/services.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2016-04-13 12:18:58 -0700
committerJosh Gao <jmgao@google.com>2016-04-13 12:28:04 -0700
commitca9af558d21c2b1e5a404687cd6f2131b0c08fe3 (patch)
treea1b1d1b3604ad6b6c7c3a2819fa23174a471a6ca /services.cpp
parentcf141d036902d1ddf68b4c21f2f9da7f121c9f63 (diff)
downloadadb-ca9af558d21c2b1e5a404687cd6f2131b0c08fe3.tar.gz
adb: add support for 'wait-for-any'.
Allow waiting for a device in any state. Bug: http://b/28168212 Change-Id: I1876ecd70089ca88f2da5de4182e13724ec50501
Diffstat (limited to 'services.cpp')
-rw-r--r--services.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/services.cpp b/services.cpp
index d5e963b..67e8e41 100644
--- a/services.cpp
+++ b/services.cpp
@@ -370,7 +370,7 @@ static void wait_for_state(int fd, void* data) {
std::string error = "unknown 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) {
+ if (t != nullptr && (sinfo->state == kCsAny || sinfo->state == t->connection_state)) {
SendOkay(fd);
break;
} else if (!is_ambiguous) {
@@ -534,6 +534,8 @@ asocket* host_service_to_socket(const char* name, const char* serial) {
sinfo->state = kCsSideload;
} else if (!strcmp(name, "-bootloader")) {
sinfo->state = kCsBootloader;
+ } else if (!strcmp(name, "-any")) {
+ sinfo->state = kCsAny;
} else {
return nullptr;
}