diff --git a/apps/root_menu.c b/apps/root_menu.c index 1ffde91eb7..71844dd41a 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -71,6 +71,7 @@ #endif #include "language.h" #include "plugin.h" +#include "disk.h" struct root_items { int (*function)(void* param); @@ -131,12 +132,12 @@ static int browser(void* param) for (i = 0; i < NUM_VOLUMES; i++) { char vol_string[VOL_ENUM_POS + 8]; - if (!storage_removable(i)) + if (!volume_removable(i)) continue; /* VOL_NAMES contains a %d */ snprintf(vol_string, sizeof(vol_string), "/"VOL_NAMES, i); /* test whether we would browse the external card */ - if (!storage_present(i) && + if (!volume_present(i) && (strstr(last_folder, vol_string) #ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN || (i == 0) diff --git a/firmware/common/disk.c b/firmware/common/disk.c index fb6daee174..5a55a3b6ac 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c @@ -292,3 +292,19 @@ int disk_unmount_all(void) return unmounted; #endif /* HAVE_MULTIDRIVE */ } + +#ifdef HAVE_HOTSWAP +bool volume_removable(int volume) +{ + if(vol_drive[volume] == -1) + return false; + return storage_removable(vol_drive[volume]); +} + +bool volume_present(int volume) +{ + if(vol_drive[volume] == -1) + return false; + return storage_present(vol_drive[volume]); +} +#endif diff --git a/firmware/export/disk.h b/firmware/export/disk.h index 8d6b41b5bd..b97ec11039 100644 --- a/firmware/export/disk.h +++ b/firmware/export/disk.h @@ -50,4 +50,9 @@ int disk_unmount(int drive); int disk_get_sector_multiplier(IF_MD_NONVOID(int drive)); #endif +#ifdef HAVE_HOTSWAP +bool volume_removable(int volume); +bool volume_present(int volume); +#endif + #endif