From 193753aa1f93ba28995a80048cbc46f1fc5cde05 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 20 Nov 2013 16:39:42 +0000 Subject: Introduce volume_{present,removable} and fix invalid calls in apps/ The code was trying to probe for volume presence by calling drive layer with volume index. It is a miracle it get unnoticed so far. Introduce proper volume probing using the vol->drive map in the disk layer. Change-Id: I463a5bcc8170f007cad049536094207d2ba3c6fc Reviewed-on: http://gerrit.rockbox.org/669 Reviewed-by: Amaury Pouly --- firmware/common/disk.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'firmware/common') 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 -- cgit v1.2.3