summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/fiio/system-fiio.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/fiio/system-fiio.c')
-rw-r--r--firmware/target/hosted/fiio/system-fiio.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/firmware/target/hosted/fiio/system-fiio.c b/firmware/target/hosted/fiio/system-fiio.c
index 46a4d0f835..3d6b1a82cd 100644
--- a/firmware/target/hosted/fiio/system-fiio.c
+++ b/firmware/target/hosted/fiio/system-fiio.c
@@ -23,6 +23,8 @@
23#include <string.h> 23#include <string.h>
24#include <ucontext.h> 24#include <ucontext.h>
25#include <backtrace.h> 25#include <backtrace.h>
26#include <fcntl.h>
27#include <sys/ioctl.h>
26 28
27#include "system.h" 29#include "system.h"
28#include "mv.h" 30#include "mv.h"
@@ -31,10 +33,12 @@
31#include "button.h" 33#include "button.h"
32#include "backlight-target.h" 34#include "backlight-target.h"
33#include "lcd.h" 35#include "lcd.h"
34
35#include "panic.h" 36#include "panic.h"
36#include <fcntl.h> 37
37#include <sys/ioctl.h> 38#include "filesystem-hosted.h"
39
40/* forward-declare */
41bool os_file_exists(const char *ospath);
38 42
39/* to make thread-internal.h happy */ 43/* to make thread-internal.h happy */
40uintptr_t *stackbegin; 44uintptr_t *stackbegin;
@@ -102,7 +106,7 @@ void power_off(void)
102 { 106 {
103 panicf("Call AXP173_SHUTDOWN fail"); 107 panicf("Call AXP173_SHUTDOWN fail");
104 } 108 }
105 109
106 close(axp_hw); 110 close(axp_hw);
107} 111}
108 112
@@ -151,17 +155,29 @@ bool hostfs_removable(IF_MD_NONVOID(int drive))
151 return true; 155 return true;
152 else 156 else
153#endif 157#endif
158#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
159 return true;
160#else
154 return false; /* internal: always present */ 161 return false; /* internal: always present */
162#endif
155} 163}
156 164
157bool hostfs_present(IF_MD_NONVOID(int drive)) 165bool hostfs_present(IF_MD_NONVOID(int drive))
158{ 166{
159#ifdef HAVE_MULTIDRIVE 167#ifdef HAVE_MULTIDRIVE
160 if (drive > 0) /* Active LOW */ 168 if (drive > 0) /* Active LOW */
161 return true; //FIXME 169#if defined(MULTIDRIVE_DEV)
170 return os_file_exists(MULTIDRIVE_DEV);
171#else
172 return true;
173#endif
162 else 174 else
163#endif 175#endif
176#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
177 return os_file_exists(ROOTDRIVE_DEV);
178#else
164 return true; /* internal: always present */ 179 return true; /* internal: always present */
180#endif
165} 181}
166 182
167#ifdef HAVE_MULTIDRIVE 183#ifdef HAVE_MULTIDRIVE
@@ -206,4 +222,3 @@ bool volume_present(int volume)
206 return hostfs_present(volume); 222 return hostfs_present(volume);
207} 223}
208#endif 224#endif
209