diff options
| -rw-r--r-- | adb/adb.h | 2 | ||||
| -rw-r--r-- | adb/services.c | 6 | ||||
| -rw-r--r-- | adb/transport.c | 5 |
3 files changed, 12 insertions, 1 deletions
@@ -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; |
