Store the proper storage description 42/187142/1 accepted/tizen/unified/20180821.090945 submit/tizen/20180820.091410
authorJihoon Jung <jh8801.jung@samsung.com>
Mon, 20 Aug 2018 07:53:53 +0000 (16:53 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Mon, 20 Aug 2018 08:01:30 +0000 (17:01 +0900)
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: I2d9d14add6d0de7d9a906aa337facca77f493620

include/mtp_config.h
packaging/mtp-responder.spec
src/entity/mtp_store.c

index 5d37986..7b02960 100755 (executable)
 
 /*To determine whether command is for Samsung mobile*/
 #define MTP_SAMSUNG_MOBILE             0x1000
-#define MTP_STORAGE_DESC_INT           "Phone"
 #define MTP_STORAGE_DESC_EXT           "Card"
 
 /*Devices Property*/
index 849f491..606535f 100755 (executable)
@@ -5,7 +5,7 @@ ExcludeArch: %arm aarch64
 
 Name:       mtp-responder
 Summary:    Media Transfer Protocol daemon (responder)
-Version:    0.0.31
+Version:    0.0.32
 Release:    1
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index 882fac5..417ec67 100755 (executable)
@@ -18,6 +18,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <system_info.h>
 #include "mtp_util.h"
 #include "mtp_support.h"
 #include "mtp_device.h"
@@ -206,6 +207,8 @@ mtp_bool _entity_init_mtp_store(mtp_store_t *store, mtp_uint32 store_id,
        mtp_wchar wtemp[MTP_MAX_REG_STRING + 1] = { 0 };
        mtp_char serial[MTP_MAX_REG_STRING + 1] = { 0 };
        mtp_wchar wserial[MTP_MAX_REG_STRING + 1] = { 0 };
+       char *profile = NULL;
+       char *storage_desc = NULL;
 
        retv_if(store == NULL, FALSE);
 
@@ -223,12 +226,31 @@ mtp_bool _entity_init_mtp_store(mtp_store_t *store, mtp_uint32 store_id,
        switch (store_id) {
        case MTP_INTERNAL_STORE_ID:
                store->is_hidden = FALSE;
+
+               system_info_get_platform_string("http://tizen.org/feature/profile", &profile);
+               if (profile != NULL) {
+                       if (g_strcmp0(profile, "mobile") == 0) {
+                               storage_desc = g_strdup("Phone");
+                       } else if (g_strcmp0(profile, "wearable") == 0) {
+                               storage_desc = g_strdup("Watch");
+                       }
+               }
+
+               if (storage_desc == NULL)
+                       storage_desc = g_strdup("Common");
+
                _util_utf8_to_utf16(wtemp, sizeof(wtemp) / WCHAR_SIZ,
-                               MTP_STORAGE_DESC_INT);
+                               storage_desc);
                __init_store_info_params(&(store->store_info),
                                store->store_info.capacity, PTP_STORAGETYPE_FIXEDRAM,
                                PTP_FILESYSTEMTYPE_HIERARCHICAL, PTP_STORAGEACCESS_RWD,
                                wtemp, wserial);
+
+               if (storage_desc != NULL)
+                       g_free(storage_desc);
+
+               if (profile != NULL)
+                       g_free(profile);
                break;
 
        case MTP_EXTERNAL_STORE_ID: