Add USB storage checker 36/64936/1 accepted/tizen/common/20160407.132603 accepted/tizen/ivi/20160407.111227 accepted/tizen/mobile/20160407.111143 accepted/tizen/tv/20160407.111153 accepted/tizen/wearable/20160407.111207 submit/tizen/20160407.051117
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 6 Apr 2016 08:54:25 +0000 (17:54 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 6 Apr 2016 08:54:25 +0000 (17:54 +0900)
Change-Id: I60d6f420efe4c799a4252a0a93c033987f8d0b73
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
packaging/media-server.spec
src/common/include/media-common-db-svc.h
src/server/media-server-device-block.c
src/server/media-server-main.c

index 7ced3cf..bd59f2c 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       media-server
 Summary:    A server for media content management
-Version:    0.2.75
+Version:    0.2.76
 Release:    0
 Group:      Multimedia/Service
 License:    Apache-2.0
index d372334..0c7eeb9 100755 (executable)
@@ -27,6 +27,7 @@
 
 #define INTERNAL_STORAGE_ID    "media"
 #define MMC_STORAGE_ID         "media"
+#define USB_STORAGE_REMOVED "usb_removed"
 
 typedef struct ms_dir_info_s {
        char *dir_path;
index da0695f..871e139 100755 (executable)
@@ -147,7 +147,21 @@ int ms_usb_remove_handler(const char *mount_path, const char *mount_uuid)
                ms_disconnect_db(&handle);
 
                ms_unload_functions();
-       }
+       } else if (strncmp(mount_path, USB_STORAGE_REMOVED, strlen(USB_STORAGE_REMOVED)) == 0 && mount_uuid  == NULL) {
+               ret = ms_load_functions();
+               if (ret != MS_MEDIA_ERR_NONE) {
+                       MS_DBG_ERR("ms_load_functions failed [%d]", ret);
+                       return ret;
+               }
+
+               ms_sys_get_uid(&uid);
+               ms_connect_db(&handle, uid);
+               ms_set_all_storage_validity(handle, 0, uid);
+
+               ms_disconnect_db(&handle);
+
+               ms_unload_functions();
+       }
 
        return ret;
 }
index 39b1594..d40c08a 100644 (file)
@@ -468,6 +468,7 @@ static int __ms_check_usb_status(void)
                        ms_sys_release_device_list(&dev_list);
                } else {
                        MS_DBG_ERR("USB NOT FOUND");
+                       ms_usb_remove_handler(USB_STORAGE_REMOVED, NULL);
                }
        } else {
                MS_DBG_ERR("ms_sys_get_device_list failed");