char *valid_type = "data";
ms_dir_scan_type_t scan_type = MS_SCAN_PART;
uid_t uid = MEDIA_DEFAULT_UID;
- char start_path[11] = {0,};
+ char storage_path[11] = {0,};
void **handle = NULL;
- ms_config_get_int(MS_DISC_STATE, &disc_state);
-
- ret = ms_load_functions();
- if (ret != MS_MEDIA_ERR_NONE) {
- MS_DBG_ERR("ms_load_functions failed [%d]", ret);
- return;
+ /*check disc type */
+ if (!ms_config_get_str(MS_DISC_TYPE, &disc_type)) {
+ MS_DBG_ERR("Get MS_DISC_TYPE failed.");
+ goto END;
}
- /* request scanning */
- ms_sys_get_uid(&uid);
+ MS_DBG("[disc type] %s", disc_type);
- ms_connect_db(&handle, uid);
+ if (strcmp(disc_type, valid_type) == 0) {
+ ms_config_get_int(MS_DISC_STATE, &disc_state);
- if (disc_state == 1) {
- /*check disc type */
- if (!ms_config_get_str(MS_DISC_TYPE, &disc_type)) {
- MS_DBG_ERR("Get MS_DISC_TYPE failed.");
- goto END;
+ ret = ms_load_functions();
+ if (ret != MS_MEDIA_ERR_NONE) {
+ MS_DBG_ERR("ms_load_functions failed [%d]", ret);
+ return;
}
- MS_DBG_WARN("[DISC INSERTED][%s]",disc_type);
+ /* request scanning */
+ ms_sys_get_uid(&uid);
- if (strcmp(disc_type, valid_type) == 0) {
- /* check mount path */
- if (!ms_config_get_str(MS_DISC_PATH, &disc_path)) {
- MS_DBG_ERR("Get MS_DISC_PATH failed.");
- goto END;
- }
+ ms_connect_db(&handle, uid);
+
+ /* check mount path */
+ if (!ms_config_get_str(MS_DISC_PATH, &disc_path)) {
+ MS_DBG_ERR("Get MS_DISC_PATH failed.");
+ goto END;
+ }
- memset(start_path, 0x0, sizeof(start_path));
- strncpy(start_path, disc_path, sizeof(start_path)-1);
- MS_DBG_WARN("MOUNT PATH [%s]", start_path);
+ MS_DBG("[disc path] %s", disc_path);
+ memset(storage_path, 0x0, sizeof(storage_path));
+ strncpy(storage_path, disc_path, sizeof(storage_path)-1);
+ if (disc_state == 1) {
+ MS_DBG_WARN("[DISC INSERTED][%s]",disc_type);
+
+ MS_DBG_WARN("MOUNT PATH [%s]", storage_path);
- ret = ms_insert_storage(handle, MMC_STORAGE_ID, NULL, start_path, uid);
+ ret = ms_insert_storage(handle, DATADISC_STORAGE_ID, NULL, storage_path, uid);
if (ret != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("ms_insert_storage failed");
+ } else {
+ ms_send_storage_scan_request(storage_path, DATADISC_STORAGE_ID, scan_type, uid);
}
-
- ms_send_storage_scan_request(start_path, MMC_STORAGE_ID, scan_type, uid);
+ } else {
+ MS_DBG_WARN("[DISC REMOVED]");
+ ms_set_storage_validity(handle, DATADISC_STORAGE_ID, 0, uid);
+ ms_set_folder_validity(handle, DATADISC_STORAGE_ID, storage_path, false, true, uid);
+ ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_STORAGE_EXTERNAL_USB, false, uid);
}
- } else {
- MS_DBG_WARN("[DISC REMOVED]");
- ms_set_storage_validity(handle, MMC_STORAGE_ID, 0, uid);
+
+ ms_disconnect_db(&handle);
+
+ ms_unload_functions();
}
END:
MS_SAFE_FREE(disc_type);
MS_SAFE_FREE(disc_path);
- ms_disconnect_db(&handle);
-
- ms_unload_functions();
-
return;
}
#endif