#define ADB_AUTH_SIGNATURE 2
#define ADB_AUTH_RSAPUBLICKEY 3
+#define TARGET_NO_SCREEN 1
+
int adb_auth_sign(void *key, void *token, size_t token_size, void *sig);
void *adb_auth_nextkey(void *current);
int adb_auth_get_userkey(unsigned char *data, size_t len);
unsigned sync_token;
int connection_state;
int online;
+ unsigned target_type;
transport_type type;
/* usb handle or socket fd as needed */
const char* ERR_LAUNCH_M_OPTION_ARGUMENT = "The -m option accepts arguments only for run or debug options";
const char* ERR_LAUNCH_P_OPTION_DEBUG_MODE = "The -P option must be used in debug mode";
const char* ERR_LAUNCH_ATTACH_OPTION_DEBUG_MODE = "The -attach option must be used in debug mode";
+
+const char* MSG_UNAUTHORIZE = "device unauthorized. Please check the confirmation dialog on your device.";
+const char* MSG_UNAUTHORIZE_NO_SCREEN = "device unauthorized. Please click reset button on your device.";
extern const char* ERR_LAUNCH_P_OPTION_DEBUG_MODE;
extern const char* ERR_LAUNCH_ATTACH_OPTION_DEBUG_MODE;
+extern const char* MSG_UNAUTHORIZE;
+extern const char* MSG_UNAUTHORIZE_NO_SCREEN;
#endif /* SDB_MESSAGE_H_ */
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)
- *error_out = "device unauthorized. Please check the confirmation dialog on your device.";
- result = NULL;
- goto exit;
- }
+ 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:
else if(cmd == A_AUTH) {
if (p->msg.arg0 == ADB_AUTH_TOKEN) {
t->connection_state = CS_UNAUTHORIZED;
+ if(p->msg.arg1 == TARGET_NO_SCREEN) {
+ t->target_type = TARGET_NO_SCREEN;
+ }
t->key = adb_auth_nextkey(t->key);
if (t->key) {
send_auth_response(p->data, p->msg.data_length, t);