if(!strcmp(tmp, STATE_DEVICE) || !strcmp(tmp, STATE_LOCKED) || !strcmp(tmp, STATE_SUSPENDED)) {
printf("connected to %s\n", remote_target_info);
return 0;
+ } else if (!strcmp(tmp, STATE_UNAUTHORIZED)) {
+ printf("device unauthorized. Please approve on your device.\n");
+ return 1;
}
} else {
// connection error occurred
#include "listener.h"
#include "sdb.h"
#include "sdb_messages.h"
+#include "adb_auth.h"
#define TRACE_TAG TRACE_SOCKETS
s->transport = t;
sdb_write(s->fd, "OKAY", 4);
D("LS(%X) get transport T(%s)", s->local_id, t->serial);
+ } else if (t && t->connection_state == CS_UNAUTHORIZED) {
+ if (t->target_type == TARGET_NO_SCREEN) {
+ err_str = MSG_UNAUTHORIZE_NO_SCREEN;
+ } else {
+ err_str = MSG_UNAUTHORIZE;
+ }
+
+ LOG_ERROR("LS(%X) transport is unauthorized.", s->local_id);
+ sendfailmsg(s->fd, err_str);
+ goto fail;
} else {
if(t != NULL) {
if(t->suspended) {
if (result == NULL ) {
*error_out = error_message(SDB_MESSAGE_ERROR, ERR_CONNECT_TARGET_NOT_FOUND, NULL);
- } else {
- if (result->connection_state == CS_UNAUTHORIZED) {
- if (error_out) {
- if(result->target_type == TARGET_NO_SCREEN)
- *error_out = MSG_UNAUTHORIZE_NO_SCREEN;
- else
- *error_out = MSG_UNAUTHORIZE;
- }
- result = NULL;
- goto exit;
- }
}
exit: