summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
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;
}