small changes to hotplugging support

This commit is contained in:
Toad King 2015-07-20 21:01:11 -05:00
parent 248e8ad1ca
commit 866970fb1c
2 changed files with 14 additions and 33 deletions

View File

@ -120,15 +120,16 @@ static void gx_devthread(void *a)
slock_lock(gx_device_mutex);
for (i = 0; i < GX_DEVICE_END; i++)
{
if (gx_devices[i].mounted &&
!gx_devices[i].interface->isInserted())
{
gx_devices[i].mounted = false;
char n[8];
snprintf(n, sizeof(n), "%s:", gx_devices[i].name);
fatUnmount(n);
for (i = 0; i < GX_DEVICE_END; i++) {
if (gx_devices[i].mounted) {
if (!gx_devices[i].interface->isInserted()) {
gx_devices[i].mounted = false;
char n[8];
snprintf(n, sizeof(n), "%s:", gx_devices[i].name);
fatUnmount(n);
}
} else if (gx_devices[i].interface->startup() && gx_devices[i].interface->isInserted()) {
gx_devices[i].mounted = fatMountSimple(gx_devices[i].name, gx_devices[i].interface);
}
}
@ -139,15 +140,6 @@ static void gx_devthread(void *a)
slock_unlock(gx_device_cond_mutex);
}
}
static int gx_get_device_from_path(const char *path)
{
if (strstr(path, "sd:") == path)
return GX_DEVICE_SD;
if (strstr(path, "usb:") == path)
return GX_DEVICE_USB;
return -1;
}
#endif
#ifdef HAVE_LOGGER

View File

@ -89,7 +89,7 @@ static void print_buf_lines(file_list_t *list, char *buf, int buf_size,
char *last = NULL;
fill_pathname_join(core_path, settings->libretro_info_path,
line_start, sizeof(core_path));
(void)last;
path_remove_extension(core_path);
@ -814,7 +814,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
fill_short_pathname_representation(path_short, path,
sizeof(path_short));
strlcpy(fill_buf,
strlcpy(fill_buf,
(label && label[0] != '\0') ? label : path_short,
sizeof(fill_buf));
@ -1936,17 +1936,6 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool *n
return 0;
}
#if defined(GEKKO) && defined(HW_RVL)
slock_lock(gx_device_mutex);
device = gx_get_device_from_path(info->path);
if (device != -1 && !gx_devices[device].mounted &&
gx_devices[device].interface->isInserted())
fatMountSimple(gx_devices[device].name, gx_devices[device].interface);
slock_unlock(gx_device_mutex);
#endif
path_is_compressed = path_is_compressed_file(info->path);
push_dir = (info->setting
&& info->setting->browser_selection_type == ST_DIR);
@ -2314,7 +2303,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
(type == DISPLAYLIST_PERFCOUNTERS_CORE) ?
perf_ptr_libretro : perf_ptr_rarch ,
(type == DISPLAYLIST_PERFCOUNTERS_CORE) ?
MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN :
MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN :
MENU_SETTINGS_PERF_COUNTERS_BEGIN);
ret = 0;
@ -2464,7 +2453,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
menu_hash_to_str(MENU_LABEL_VALUE_DISK_INDEX),
menu_hash_to_str(MENU_LABEL_DISK_INDEX),
MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_INDEX, 0, 0);
menu_list_push(info->list,
menu_list_push(info->list,
menu_hash_to_str(MENU_LABEL_VALUE_DISK_CYCLE_TRAY_STATUS),
menu_hash_to_str(MENU_LABEL_DISK_CYCLE_TRAY_STATUS),
MENU_SETTINGS_CORE_DISK_OPTIONS_DISK_CYCLE_TRAY_STATUS, 0, 0);