aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-08-08 13:53:16 -0400
committerMike Lockwood <lockwood@android.com>2009-08-08 13:53:16 -0400
commit37d3111b1c1ce61c3d9b10ed3ccaed9e5fad1e06 (patch)
tree3a32ff94ea67bee25c2ec929166228b1ecb6cc6d
parent5c93dba771f11bb2228e69d1585c9fe8339c9275 (diff)
downloadsystem_core-37d3111b1c1ce61c3d9b10ed3ccaed9e5fad1e06.tar.gz
system_core-37d3111b1c1ce61c3d9b10ed3ccaed9e5fad1e06.tar.bz2
system_core-37d3111b1c1ce61c3d9b10ed3ccaed9e5fad1e06.zip
adb: print better error message when there are insufficient permissions for a device.
Now, a command like "adb shell" will print "insufficient permissions for device" instead of "device not found" if adb does not have permissions to communicate with the device. Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r--adb/transport.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/adb/transport.c b/adb/transport.c
index 831b6fc6..c9e7752f 100644
--- a/adb/transport.c
+++ b/adb/transport.c
@@ -720,7 +720,11 @@ retry:
adb_mutex_lock(&transport_lock);
for (t = transport_list.next; t != &transport_list; t = t->next) {
- if (t->connection_state == CS_NOPERM) continue;
+ if (t->connection_state == CS_NOPERM) {
+ if (error_out)
+ *error_out = "insufficient permissions for device";
+ continue;
+ }
/* check for matching serial number */
if (serial) {
@@ -768,12 +772,6 @@ retry:
*error_out = "device offline";
result = NULL;
}
- if (result && result->connection_state == CS_NOPERM) {
- if (error_out)
- *error_out = "no permissions for device";
- result = NULL;
- }
-
/* check for required connection state */
if (result && state != CS_ANY && result->connection_state != state) {
if (error_out)