Print message "Please click reset button on your device" if KITT target is unauthorized.
authorshingil.kang <shingil.kang@samsung.com>
Mon, 28 Mar 2016 11:42:29 +0000 (20:42 +0900)
committershingil.kang <shingil.kang@samsung.com>
Tue, 5 Apr 2016 02:00:26 +0000 (11:00 +0900)
Change-Id: I40228816400d00fd1475b7585c54abadb7c00142
Signed-off-by: shingil.kang <shingil.kang@samsung.com>
src/adb_auth.h
src/common_modules.h
src/sdb_messages.c
src/sdb_messages.h
src/transport.c

index a70c8c49b96fc5592d9749a2991bff2c4afd8b1c..fbe16bf319c13e1c117c911335520c42e870be00 100644 (file)
@@ -30,6 +30,8 @@ void send_auth_request(atransport *t);
 #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);
index 326f6f7182581e0cb2b3e6c15866cc17ed24db45..5170c846b6b71770ad4c51eaa56c2b56c9894b89 100644 (file)
@@ -167,6 +167,7 @@ struct atransport
     unsigned sync_token;
     int connection_state;
     int online;
+    unsigned target_type;
     transport_type type;
 
         /* usb handle or socket fd as needed */
index b7bc32f7832b5d47bb28ddaacae4aa43f401c9b8..b3080d57b34cd6a370848e2e66461aed18aacb76 100644 (file)
@@ -99,3 +99,6 @@ const char* ERR_LAUNCH_M_OPTION_SUPPORT = "In DA and Oprofile, the -m option is
 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.";
index 656864e7876b9dfdc6234bd00c3afef69e5e585c..64cdd1522646bd728a108f19f8dff6122d9697b3 100644 (file)
@@ -101,4 +101,6 @@ extern const char* ERR_LAUNCH_M_OPTION_ARGUMENT;
 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_ */
index c6a3eb96ba9af6b939aa1861055602e4563de653..0224f912cbefd041652c6224b55e80903e2213f2 100755 (executable)
@@ -620,12 +620,16 @@ TRANSPORT *acquire_one_transport(transport_type ttype, const char* serial, char*
     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:
@@ -946,6 +950,9 @@ void wakeup_select_func(int _fd, unsigned ev, void *data) {
     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);