qapi_free_BlockInfoList(block_list);
LOG_INFO("sdcard data: %s\n", data);
- if (data[0] == 0) {
- make_send_device_ntf((char*)MSG_TYPE_SDCARD, GROUP_SDCARD, ACT_SDCARD_DETACH_STATUS, NULL);
- } else {
+ if (is_sdcard_attached() && data[0] != 0) {
make_send_device_ntf((char*)MSG_TYPE_SDCARD, GROUP_SDCARD, ACT_SDCARD_ATTACH_STATUS, data);
+ } else {
+ make_send_device_ntf((char*)MSG_TYPE_SDCARD, GROUP_SDCARD, ACT_SDCARD_DETACH_STATUS, NULL);
}
}
err_no = remove_sdcard_lock_os(sdcard_full_path);
if (err_no == 0 && is_sdcard_attached()) {
do_hotplug(DETACH_SDCARD, sdcard_full_path, strlen(sdcard_full_path) + 1);
- make_send_device_ntf((char*)MSG_TYPE_SDCARD, GROUP_SDCARD,
- ACT_SDCARD_DETACH, g_path_get_basename(sdcard_full_path));
} else {
LOG_SEVERE("failed to umount: %s, err_no: %d\n", sdcard_full_path, err_no);
make_send_device_ntf((char*)MSG_TYPE_SDCARD, GROUP_SDCARD,
LOG_TRACE("sdcard_full_path: %s\n", sdcard_full_path);
if (!is_sdcard_attached() && make_sdcard_lock_os(sdcard_full_path)) {
do_hotplug(ATTACH_SDCARD, sdcard_full_path, strlen(sdcard_full_path) + 1);
- make_send_device_ntf((char*)MSG_TYPE_SDCARD, GROUP_SDCARD,
- ACT_SDCARD_ATTACH, g_path_get_basename(sdcard_full_path));
} else {
make_send_device_ntf((char*)MSG_TYPE_SDCARD, GROUP_SDCARD,
ACT_SDCARD_ATTACH_FAIL, g_path_get_basename(sdcard_full_path));
g_free(sdcard_device_id);
g_free(sdcard_drive_id);
state->sdcard_attached = true;
+ make_send_device_ntf((char*)MSG_TYPE_SDCARD, GROUP_SDCARD,
+ ACT_SDCARD_ATTACH, g_path_get_basename(file));
return true;
}
QDECREF(qdict);
state->sdcard_attached = false;
+ make_send_device_ntf((char*)MSG_TYPE_SDCARD, GROUP_SDCARD,
+ ACT_SDCARD_DETACH, g_path_get_basename(file));
+
g_free(sdcard_drive_id);
return true;
}