summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaekyu Park <jk7744.park@samsung.com>2016-05-27 16:53:33 +0900
committerJaekyu Park <jk7744.park@samsung.com>2016-05-27 16:53:33 +0900
commitebfeb294baacdbd213d242ae316a9415fa0b8f8d (patch)
tree37475c159810684d3ec5efc3981ec7ad22ea3157
parenta9e030aa76f3af2c7b2ceb71504ac4364db70f11 (diff)
downloadmedia-server-ebfeb294baacdbd213d242ae316a9415fa0b8f8d.tar.gz
media-server-ebfeb294baacdbd213d242ae316a9415fa0b8f8d.tar.bz2
media-server-ebfeb294baacdbd213d242ae316a9415fa0b8f8d.zip
-rwxr-xr-xlib/media-util-db.c5
-rwxr-xr-xpackaging/media-server.spec2
-rwxr-xr-xsrc/common/include/media-common-external-storage.h2
-rwxr-xr-xsrc/common/include/media-common-system.h1
-rwxr-xr-xsrc/common/include/media-common-types.h1
-rwxr-xr-xsrc/common/media-common-external-storage.c10
-rwxr-xr-xsrc/common/media-common-system.c13
-rwxr-xr-xsrc/server/media-server-device-block.c8
8 files changed, 29 insertions, 13 deletions
diff --git a/lib/media-util-db.c b/lib/media-util-db.c
index 95bc281..f1549f2 100755
--- a/lib/media-util-db.c
+++ b/lib/media-util-db.c
@@ -166,7 +166,10 @@ static int __media_db_request_update_tcp(ms_msg_type_e msg_type, const char *req
if (connect(sockfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
MSAPI_DBG_STRERROR("connect error");
close(sockfd);
- return MS_MEDIA_ERR_SOCKET_CONN;
+ if (errno == EACCES)
+ return MS_MEDIA_ERR_PERMISSION_DENIED;
+ else
+ return MS_MEDIA_ERR_SOCKET_CONN;
}
/* Send request */
diff --git a/packaging/media-server.spec b/packaging/media-server.spec
index 4d0ac31..6900e5c 100755
--- a/packaging/media-server.spec
+++ b/packaging/media-server.spec
@@ -1,6 +1,6 @@
Name: media-server
Summary: File manager service server.
-Version: 0.2.122
+Version: 0.2.123
Release: 1
Group: utils
License: Apache-2.0
diff --git a/src/common/include/media-common-external-storage.h b/src/common/include/media-common-external-storage.h
index c74fc10..dfd4fcd 100755
--- a/src/common/include/media-common-external-storage.h
+++ b/src/common/include/media-common-external-storage.h
@@ -26,7 +26,7 @@
void ms_make_default_path_mmc(void);
#ifndef DISABLE_NOTIFICATION
-int ms_present_mmc_status(ms_sdcard_status_type_t status);
+int ms_present_mmc_status(ms_sdcard_status_type_t status, int flags);
#endif
int ms_get_mmc_id(char **cid);
diff --git a/src/common/include/media-common-system.h b/src/common/include/media-common-system.h
index 6f74794..ee24c16 100755
--- a/src/common/include/media-common-system.h
+++ b/src/common/include/media-common-system.h
@@ -40,6 +40,7 @@ typedef struct ms_block_info_s{
char *mount_path;
int state;
int block_type;
+ int flags;
} ms_block_info_s;
typedef void (*block_changed_cb)(ms_block_info_s *block_info, void *user_data);
diff --git a/src/common/include/media-common-types.h b/src/common/include/media-common-types.h
index 9912233..36267b5 100755
--- a/src/common/include/media-common-types.h
+++ b/src/common/include/media-common-types.h
@@ -69,6 +69,7 @@ typedef enum {
MS_SDCARD_INSERTED, /**< Stored only in phone */
MS_SDCARD_REMOVED, /**< Stored only in MMC */
} ms_sdcard_status_type_t;
+#define MS_SDCARD_REMOVED_UNSAFE 0x0001 /* Removed without unmount */
typedef enum {
MS_SCAN_INVALID,
diff --git a/src/common/media-common-external-storage.c b/src/common/media-common-external-storage.c
index 031af01..bbbee85 100755
--- a/src/common/media-common-external-storage.c
+++ b/src/common/media-common-external-storage.c
@@ -68,7 +68,7 @@ char default_path[][MS_FILE_NAME_LEN_MAX + 1] = {
#define BLOCK_OBJECT_ADDED "ObjectAdded"
#define BLOCK_OBJECT_REMOVED "ObjectRemoved"
-#define BLOCK_DEVICE_CHANGED "DeviceChanged"
+#define BLOCK_DEVICE_CHANGED "DeviceChanged2"
GDBusConnection *g_stg_bus;
int g_stg_added_handler;
@@ -157,7 +157,7 @@ void update_lang(void)
}
}
-int ms_present_mmc_status(ms_sdcard_status_type_t status)
+int ms_present_mmc_status(ms_sdcard_status_type_t status, int flags)
{
int ret = NOTIFICATION_ERROR_NONE;
@@ -165,8 +165,10 @@ int ms_present_mmc_status(ms_sdcard_status_type_t status)
if (status == MS_SDCARD_INSERTED)
ret = notification_status_message_post(_GETSYSTEMSTR("IDS_COM_BODY_PREPARING_SD_CARD"));
- else if (status == MS_SDCARD_REMOVED)
- ret = notification_status_message_post(_GETSYSTEMSTR("IDS_COM_BODY_SD_CARD_UNEXPECTEDLY_REMOVED"));
+ else if (status == MS_SDCARD_REMOVED) {
+ if (flags & MS_SDCARD_REMOVED_UNSAFE)
+ ret = notification_status_message_post(_GETSYSTEMSTR("IDS_COM_BODY_SD_CARD_UNEXPECTEDLY_REMOVED"));
+ }
if(ret != NOTIFICATION_ERROR_NONE)
return MS_MEDIA_ERR_INTERNAL;
diff --git a/src/common/media-common-system.c b/src/common/media-common-system.c
index d784af4..66234ab 100755
--- a/src/common/media-common-system.c
+++ b/src/common/media-common-system.c
@@ -50,9 +50,9 @@
#define BLOCK_OBJECT_ADDED "ObjectAdded"
#define BLOCK_OBJECT_REMOVED "ObjectRemoved"
-#define BLOCK_DEVICE_CHANGED "DeviceChanged"
+#define BLOCK_DEVICE_CHANGED "DeviceChanged2"
-#define BLOCK_DEVICE_METHOD "GetDeviceList"
+#define BLOCK_DEVICE_METHOD "GetDeviceList2"
#define BLOCK_DEVICE_USB "scsi"
#define BLOCK_DEVICE_MMC "mmc"
#define BLOCK_DEVICE_ALL "all"
@@ -110,6 +110,10 @@ static void __ms_block_changed(GDBusConnection* connection,
block_info->state = g_variant_get_int32 (tmp);
MS_DBG_ERR("state : %d", block_info->state);
+ tmp = g_variant_get_child_value(parameters, 11);
+ block_info->flags = g_variant_get_int32 (tmp);
+ MS_DBG_ERR("flags : %d", block_info->flags);
+
((block_changed_cb)usr_cb)(block_info, usr_data);
MS_SAFE_FREE(block_info->mount_path);
MS_SAFE_FREE(block_info);
@@ -303,6 +307,11 @@ static int __ms_dbus_method_sync(const char *dest, const char *path,
dbus_message_iter_get_basic(&piter, &val_bool);
MS_DBG("\tprimary(%d)", val_bool ? "true" : "false");
+ dbus_message_iter_next(&piter);
+ dbus_message_iter_get_basic(&piter, &val_int);
+ MS_DBG("\tflags(%d)", val_int);
+ data->flags = val_int;
+
dbus_message_iter_next(&aiter);
if (*dev_list == NULL) {
diff --git a/src/server/media-server-device-block.c b/src/server/media-server-device-block.c
index 5cb56df..49044d1 100755
--- a/src/server/media-server-device-block.c
+++ b/src/server/media-server-device-block.c
@@ -249,7 +249,7 @@ int ms_mmc_insert_handler(const char *mount_path)
}
ms_make_default_path_mmc();
- ms_present_mmc_status(MS_SDCARD_INSERTED);
+ ms_present_mmc_status(MS_SDCARD_INSERTED, 0);
ms_get_mmc_id(&cid);
__ms_get_mmc_info(db_handle, &storage_name, &storage_path, &validity, &info_exist);
@@ -318,7 +318,7 @@ int ms_mmc_remove_handler(const char *mount_path)
return MS_MEDIA_ERR_NONE;
}
-void _ms_mmc_changed_event(const char *mount_path, ms_stg_status_e mount_status)
+void _ms_mmc_changed_event(const char *mount_path, ms_stg_status_e mount_status, int flags)
{
/* If scanner is not working, media server executes media scanner and sends request. */
/* If scanner is working, it detects changing status of SD card. */
@@ -326,7 +326,7 @@ void _ms_mmc_changed_event(const char *mount_path, ms_stg_status_e mount_status)
ms_mmc_insert_handler(mount_path);
} else if (mount_status == MS_STG_REMOVED) {
/*remove added watch descriptors */
- ms_present_mmc_status(MS_SDCARD_REMOVED);
+ ms_present_mmc_status(MS_SDCARD_REMOVED, flags);
ms_mmc_remove_handler(mount_path);
}
@@ -352,7 +352,7 @@ void ms_device_block_changed_cb(ms_block_info_s *block_info, void *user_data)
_ms_usb_changed_event(block_info->mount_path, block_info->state);
} else {
MS_DBG_ERR("GET THE MMC EVENT");
- _ms_mmc_changed_event(block_info->mount_path, block_info->state);
+ _ms_mmc_changed_event(block_info->mount_path, block_info->state, block_info->flags);
}
}