aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2013-04-13 13:16:55 -0700
committerSteve Kondik <shade@chemlab.org>2013-04-13 13:16:55 -0700
commitbec571faf81a6e2220c2ecc274d1e40c3ff08460 (patch)
tree3037e28d9489d5ec62405d1e4030e7abeb78d230
parent7b080181a479613acb8d4d3935f736e1c3147873 (diff)
downloadsystem_core-bec571faf81a6e2220c2ecc274d1e40c3ff08460.tar.gz
system_core-bec571faf81a6e2220c2ecc274d1e40c3ff08460.tar.bz2
system_core-bec571faf81a6e2220c2ecc274d1e40c3ff08460.zip
adb: Add a few more wait-for commands
* wait-for-recovery is obvious. * wait-for-online will wait for recovery || device Change-Id: I70f747bcd201a4157b988d7ed49bcc8e5ff4c85f
-rw-r--r--adb/adb.h2
-rw-r--r--adb/services.c6
-rw-r--r--adb/transport.c5
3 files changed, 12 insertions, 1 deletions
diff --git a/adb/adb.h b/adb/adb.h
index 9da8af8b..a2ad33ce 100644
--- a/adb/adb.h
+++ b/adb/adb.h
@@ -469,6 +469,8 @@ int connection_state(atransport *t);
#define CS_NOPERM 5 /* Insufficient permissions to communicate with the device */
#define CS_SIDELOAD 6
+#define CS_ONLINE 10 /* recovery or device */
+
extern int HOST;
extern int SHELL_EXIT_NOTIFY_FD;
diff --git a/adb/services.c b/adb/services.c
index 22fccf44..7792ccdd 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -572,6 +572,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.c b/adb/transport.c
index 9fd6cc2e..d0af2444 100644
--- a/adb/transport.c
+++ b/adb/transport.c
@@ -857,8 +857,11 @@ retry:
*error_out = "device offline";
result = NULL;
}
+
/* check for required connection state */
- if (result && state != CS_ANY && result->connection_state != 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;