summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2013-04-13 13:16:55 -0700
committerSteve Kondik <steve@cyngn.com>2015-10-17 17:47:21 -0700
commitda40dde17b90d1867edf362d6c32c3b57567f0ec (patch)
tree1c09e7fa877e60966fe01104cd7bfae4af0bae1f /adb
parent01274cc73fa9fd8da3899b0078a193ab5a2dc997 (diff)
downloadsystem_core-da40dde17b90d1867edf362d6c32c3b57567f0ec.zip
system_core-da40dde17b90d1867edf362d6c32c3b57567f0ec.tar.gz
system_core-da40dde17b90d1867edf362d6c32c3b57567f0ec.tar.bz2
adb: Add a few more wait-for commands
* wait-for-recovery is obvious. * wait-for-online will wait for recovery || device Change-Id: I70f747bcd201a4157b988d7ed49bcc8e5ff4c85f
Diffstat (limited to 'adb')
-rw-r--r--adb/adb.h3
-rw-r--r--adb/services.cpp6
-rw-r--r--adb/transport.cpp6
3 files changed, 13 insertions, 2 deletions
diff --git a/adb/adb.h b/adb/adb.h
index fd9d0e6..98cc4ca 100644
--- a/adb/adb.h
+++ b/adb/adb.h
@@ -350,6 +350,9 @@ int connection_state(atransport *t);
#define CS_UNAUTHORIZED 7
extern const char *adb_device_banner;
+
+#define CS_ONLINE 10 /* recovery or device */
+
extern int HOST;
extern int SHELL_EXIT_NOTIFY_FD;
diff --git a/adb/services.cpp b/adb/services.cpp
index 4e8e5a8..abc7695 100644
--- a/adb/services.cpp
+++ b/adb/services.cpp
@@ -688,6 +688,12 @@ asocket* host_service_to_socket(const char* name, const char *serial)
} else if (!strncmp(name, "sideload", strlen("sideload"))) {
sinfo->transport = kTransportAny;
sinfo->state = CS_SIDELOAD;
+ } else if (!strncmp(name, "recovery", strlen("recovery"))) {
+ sinfo->transport = kTransportAny;
+ sinfo->state = CS_RECOVERY;
+ } else if (!strncmp(name, "online", strlen("online"))) {
+ sinfo->transport = kTransportAny;
+ sinfo->state = CS_ONLINE;
} else {
free(sinfo);
return NULL;
diff --git a/adb/transport.cpp b/adb/transport.cpp
index 2cd6ac2..5ae49d3 100644
--- a/adb/transport.cpp
+++ b/adb/transport.cpp
@@ -821,8 +821,10 @@ retry:
result = NULL;
}
- /* check for required connection state */
- if (result && state != CS_ANY && result->connection_state != state) {
+ /* check for required connection state */
+ if (result && state != CS_ANY && ((state != CS_ONLINE && result->connection_state != state)
+ || (state == CS_ONLINE && !(result->connection_state == CS_DEVICE
+ || result->connection_state == CS_RECOVERY)))) {
if (error_out) *error_out = "invalid device state";
result = NULL;
}