Add check rule for is_support_debug_option().
authorKim Gunsoo <gunsoo83.kim@samsung.com>
Wed, 17 Feb 2016 02:45:02 +0000 (11:45 +0900)
committerKim Gunsoo <gunsoo83.kim@samsung.com>
Wed, 17 Feb 2016 05:06:24 +0000 (14:06 +0900)
- For 2.4 Emulator, Added check rule that
  the profile_command version is 4.0 or higher.

Change-Id: I83cf2f160be412a17b1cba1e267c3b4d9162fcc3
Signed-off-by: Kim Gunsoo <gunsoo83.kim@samsung.com>
src/command_function.c

index d0697cf3bad029ecb31426f32e7d95d4afd0d3d1..df86a37eb83020e2736444b032049e5158b8d237 100644 (file)
@@ -650,8 +650,43 @@ static int is_support_debug_option(void){
         readx(fd, cap_buffer, len);
         sdb_close(fd);
 
+        /* This routine is temporarily coded in a state that the app
+         * protocol version design is not complete.
+         * To suppurt 2.3.1 WC payment, this logic MUST be still remained.
+         * This routine is also coded in sdblib. */
         ret = match_capability_key_value(cap_buffer, "sdbd_rootperm", "disabled");
+        if (ret == 1) {
+            return ret;
+        }
+    }
+
+    /* This routine is temporarily coded in a state that the app
+     * protocol version design is not complete.
+     * To suppurt 2.4 Emulator, this logic MUST be still remained.
+     * This routine is also coded in sdblib. */
+    /* try to check profile_command version */
+    D("sdbd_rootperm is NOT available. try to check profile_command version\n");
+    char buf[512] = {};
+
+    const char* SHELL_GET_PROFILE_VER_CMD ="shell:/usr/bin/profile_command getversion";
+    fd = sdb_connect(SHELL_GET_PROFILE_VER_CMD);
+
+    if(fd < 0) {
+        // default : not support -G option.
+        return -1;
     }
+    if (read_line(fd, buf, sizeof(buf)) > 0) {
+        int major = 0;
+        int minor = 0;
+        if (sscanf(buf, "%d.%d", &major, &minor) == 2) {
+            // major version number at least 4
+            if (major >= 4) {
+                ret = 1;
+            }
+        }
+    }
+    sdb_close(fd);
+
     return ret;
 }