diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-17 17:21:34 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-17 18:38:49 -0400 |
commit | f3ec58c05b1f0044240cf5e95ff28e6966398958 (patch) | |
tree | e9e93c118708a5d6fe792f5529c9f735ede4a3db /firmware/target/hosted/system-hosted.c | |
parent | d8d37ffdb8bed39df5d021afa9e09bf087b45d0d (diff) | |
download | rockbox-f3ec58c05b1f0044240cf5e95ff28e6966398958.tar.gz rockbox-f3ec58c05b1f0044240cf5e95ff28e6966398958.tar.bz2 rockbox-f3ec58c05b1f0044240cf5e95ff28e6966398958.zip |
hosted: Support hot-swappable internal and external storage
Change-Id: I321e9da4d5087dbd91194e6faa35cd4a685a0495
Diffstat (limited to 'firmware/target/hosted/system-hosted.c')
-rw-r--r-- | firmware/target/hosted/system-hosted.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/firmware/target/hosted/system-hosted.c b/firmware/target/hosted/system-hosted.c index f485dc4c15..fa492c1094 100644 --- a/firmware/target/hosted/system-hosted.c +++ b/firmware/target/hosted/system-hosted.c @@ -31,11 +31,15 @@ #include "button.h" #include "backlight-target.h" #include "lcd.h" +#include "filesystem-hosted.h" /* to make thread-internal.h happy */ uintptr_t *stackbegin; uintptr_t *stackend; +/* forward-declare */ +bool os_file_exists(const char *ospath); + static void sig_handler(int sig, siginfo_t *siginfo, void *context) { /* safe guard variable - we call backtrace() only on first @@ -134,17 +138,29 @@ bool hostfs_removable(IF_MD_NONVOID(int drive)) return true; else #endif +#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN + return true; +#else return false; /* internal: always present */ +#endif } bool hostfs_present(IF_MD_NONVOID(int drive)) { #ifdef HAVE_MULTIDRIVE - if (drive > 0) /* Active LOW */ - return true; //FIXME + if (drive > 0) +#if defined(MULTIDRIVE_DEV) + return os_file_exists(MULTIDRIVE_DEV); +#else + return true; // FIXME? +#endif else #endif +#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN + return os_file_exists(ROOTDRIVE_DEV); +#else return true; /* internal: always present */ +#endif } #ifdef HAVE_MULTIDRIVE |