From bd4b190e780dc78d6ab99ff9f661ec0a3ae1cad6 Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Mon, 20 Aug 2018 16:53:53 +0900 Subject: [PATCH] Store the proper storage description Signed-off-by: Jihoon Jung Change-Id: I2d9d14add6d0de7d9a906aa337facca77f493620 --- include/mtp_config.h | 1 - packaging/mtp-responder.spec | 2 +- src/entity/mtp_store.c | 24 +++++++++++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/include/mtp_config.h b/include/mtp_config.h index 5d37986..7b02960 100755 --- a/include/mtp_config.h +++ b/include/mtp_config.h @@ -115,7 +115,6 @@ /*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*/ diff --git a/packaging/mtp-responder.spec b/packaging/mtp-responder.spec index 849f491..606535f 100755 --- a/packaging/mtp-responder.spec +++ b/packaging/mtp-responder.spec @@ -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 diff --git a/src/entity/mtp_store.c b/src/entity/mtp_store.c index 882fac5..417ec67 100755 --- a/src/entity/mtp_store.c +++ b/src/entity/mtp_store.c @@ -18,6 +18,7 @@ #include #include #include +#include #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: -- 2.7.4