diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/target/hosted/fiio/system-fiio.c | 27 | ||||
-rw-r--r-- | firmware/target/hosted/system-hosted.c | 20 |
2 files changed, 39 insertions, 8 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 */ | ||
41 | bool os_file_exists(const char *ospath); | ||
38 | 42 | ||
39 | /* to make thread-internal.h happy */ | 43 | /* to make thread-internal.h happy */ |
40 | uintptr_t *stackbegin; | 44 | uintptr_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 | ||
157 | bool hostfs_present(IF_MD_NONVOID(int drive)) | 165 | bool 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 | |||
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 @@ | |||
31 | #include "button.h" | 31 | #include "button.h" |
32 | #include "backlight-target.h" | 32 | #include "backlight-target.h" |
33 | #include "lcd.h" | 33 | #include "lcd.h" |
34 | #include "filesystem-hosted.h" | ||
34 | 35 | ||
35 | /* to make thread-internal.h happy */ | 36 | /* to make thread-internal.h happy */ |
36 | uintptr_t *stackbegin; | 37 | uintptr_t *stackbegin; |
37 | uintptr_t *stackend; | 38 | uintptr_t *stackend; |
38 | 39 | ||
40 | /* forward-declare */ | ||
41 | bool os_file_exists(const char *ospath); | ||
42 | |||
39 | static void sig_handler(int sig, siginfo_t *siginfo, void *context) | 43 | static void sig_handler(int sig, siginfo_t *siginfo, void *context) |
40 | { | 44 | { |
41 | /* safe guard variable - we call backtrace() only on first | 45 | /* safe guard variable - we call backtrace() only on first |
@@ -134,17 +138,29 @@ bool hostfs_removable(IF_MD_NONVOID(int drive)) | |||
134 | return true; | 138 | return true; |
135 | else | 139 | else |
136 | #endif | 140 | #endif |
141 | #ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN | ||
142 | return true; | ||
143 | #else | ||
137 | return false; /* internal: always present */ | 144 | return false; /* internal: always present */ |
145 | #endif | ||
138 | } | 146 | } |
139 | 147 | ||
140 | bool hostfs_present(IF_MD_NONVOID(int drive)) | 148 | bool hostfs_present(IF_MD_NONVOID(int drive)) |
141 | { | 149 | { |
142 | #ifdef HAVE_MULTIDRIVE | 150 | #ifdef HAVE_MULTIDRIVE |
143 | if (drive > 0) /* Active LOW */ | 151 | if (drive > 0) |
144 | return true; //FIXME | 152 | #if defined(MULTIDRIVE_DEV) |
153 | return os_file_exists(MULTIDRIVE_DEV); | ||
154 | #else | ||
155 | return true; // FIXME? | ||
156 | #endif | ||
145 | else | 157 | else |
146 | #endif | 158 | #endif |
159 | #ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN | ||
160 | return os_file_exists(ROOTDRIVE_DEV); | ||
161 | #else | ||
147 | return true; /* internal: always present */ | 162 | return true; /* internal: always present */ |
163 | #endif | ||
148 | } | 164 | } |
149 | 165 | ||
150 | #ifdef HAVE_MULTIDRIVE | 166 | #ifdef HAVE_MULTIDRIVE |