diff options
-rw-r--r-- | firmware/export/config/ibassodx50.h | 9 | ||||
-rw-r--r-- | firmware/export/config/ibassodx90.h | 9 | ||||
-rw-r--r-- | firmware/target/hosted/ibasso/system-ibasso.c | 55 | ||||
-rw-r--r-- | firmware/target/hosted/ibasso/vold-ibasso.c | 5 | ||||
-rw-r--r-- | firmware/target/hosted/ibasso/vold-ibasso.h | 2 |
5 files changed, 75 insertions, 5 deletions
diff --git a/firmware/export/config/ibassodx50.h b/firmware/export/config/ibassodx50.h index 6bebf5a278..bb4b2809e5 100644 --- a/firmware/export/config/ibassodx50.h +++ b/firmware/export/config/ibassodx50.h | |||
@@ -140,9 +140,14 @@ | |||
140 | /* Define this if a programmable hotkey is mapped */ | 140 | /* Define this if a programmable hotkey is mapped */ |
141 | #define HAVE_HOTKEY | 141 | #define HAVE_HOTKEY |
142 | 142 | ||
143 | /* No special storage */ | 143 | /* Supports internal and microSD storage */ |
144 | #define CONFIG_STORAGE STORAGE_HOSTFS | 144 | #define CONFIG_STORAGE (STORAGE_HOSTFS|STORAGE_SD) |
145 | #define HOSTFS_VOL_DEC "Internal" | ||
145 | #define HAVE_STORAGE_FLUSH | 146 | #define HAVE_STORAGE_FLUSH |
147 | #define HAVE_MULTIDRIVE /* But _not_ CONFIG_STORAGE_MULTI */ | ||
148 | #define NUM_DRIVES 2 | ||
149 | #define HAVE_HOTSWAP | ||
150 | #define MULTIDRIVE_DIR "/mnt/external_sd" | ||
146 | 151 | ||
147 | /* More common stuff */ | 152 | /* More common stuff */ |
148 | #define BATTERY_DEV_NAME "battery" | 153 | #define BATTERY_DEV_NAME "battery" |
diff --git a/firmware/export/config/ibassodx90.h b/firmware/export/config/ibassodx90.h index 0b33665eb4..cd7ddf78cd 100644 --- a/firmware/export/config/ibassodx90.h +++ b/firmware/export/config/ibassodx90.h | |||
@@ -137,9 +137,14 @@ | |||
137 | /* Define this if a programmable hotkey is mapped */ | 137 | /* Define this if a programmable hotkey is mapped */ |
138 | #define HAVE_HOTKEY | 138 | #define HAVE_HOTKEY |
139 | 139 | ||
140 | /* No special storage */ | 140 | /* Supports internal and microSD storage */ |
141 | #define CONFIG_STORAGE STORAGE_HOSTFS | 141 | #define CONFIG_STORAGE (STORAGE_HOSTFS|STORAGE_SD) |
142 | #define HOSTFS_VOL_DEC "Internal" | ||
142 | #define HAVE_STORAGE_FLUSH | 143 | #define HAVE_STORAGE_FLUSH |
144 | #define HAVE_MULTIDRIVE /* But _not_ CONFIG_STORAGE_MULTI */ | ||
145 | #define NUM_DRIVES 2 | ||
146 | #define HAVE_HOTSWAP | ||
147 | #define MULTIDRIVE_DIR "/mnt/external_sd" | ||
143 | 148 | ||
144 | /* More common stuff */ | 149 | /* More common stuff */ |
145 | #define BATTERY_DEV_NAME "battery" | 150 | #define BATTERY_DEV_NAME "battery" |
diff --git a/firmware/target/hosted/ibasso/system-ibasso.c b/firmware/target/hosted/ibasso/system-ibasso.c index 45a6514aa2..401bb3c442 100644 --- a/firmware/target/hosted/ibasso/system-ibasso.c +++ b/firmware/target/hosted/ibasso/system-ibasso.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include "config.h" | 29 | #include "config.h" |
30 | #include "debug.h" | 30 | #include "debug.h" |
31 | #include "mv.h" | ||
31 | 32 | ||
32 | #include "button-ibasso.h" | 33 | #include "button-ibasso.h" |
33 | #include "debug-ibasso.h" | 34 | #include "debug-ibasso.h" |
@@ -39,6 +40,8 @@ | |||
39 | uintptr_t* stackbegin; | 40 | uintptr_t* stackbegin; |
40 | uintptr_t* stackend; | 41 | uintptr_t* stackend; |
41 | 42 | ||
43 | /* forward-declare */ | ||
44 | bool os_file_exists(const char *ospath); | ||
42 | 45 | ||
43 | void system_init(void) | 46 | void system_init(void) |
44 | { | 47 | { |
@@ -95,3 +98,55 @@ void system_exception_wait(void) | |||
95 | 98 | ||
96 | while(1) {}; | 99 | while(1) {}; |
97 | } | 100 | } |
101 | |||
102 | bool hostfs_removable(IF_MD_NONVOID(int drive)) | ||
103 | { | ||
104 | #ifdef HAVE_MULTIDRIVE | ||
105 | if (drive > 0) | ||
106 | return true; | ||
107 | else | ||
108 | #endif | ||
109 | return false; /* internal: always present */ | ||
110 | } | ||
111 | |||
112 | #ifdef HAVE_MULTIDRIVE | ||
113 | int volume_drive(int drive) | ||
114 | { | ||
115 | return drive; | ||
116 | } | ||
117 | #endif /* HAVE_MULTIDRIVE */ | ||
118 | |||
119 | #ifdef CONFIG_STORAGE_MULTI | ||
120 | int hostfs_driver_type(int drive) | ||
121 | { | ||
122 | return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM; | ||
123 | } | ||
124 | #endif /* CONFIG_STORAGE_MULTI */ | ||
125 | |||
126 | bool hostfs_present(IF_MD_NONVOID(int drive)) | ||
127 | { | ||
128 | #ifdef HAVE_MULTIDRIVE | ||
129 | if (drive > 0) | ||
130 | #if defined(MULTIDRIVE_DEV) | ||
131 | return os_file_exists(MULTIDRIVE_DEV); | ||
132 | #else | ||
133 | return extsd_present; | ||
134 | #endif | ||
135 | else | ||
136 | #endif | ||
137 | return true; /* internal: always present */ | ||
138 | } | ||
139 | |||
140 | #ifdef HAVE_HOTSWAP | ||
141 | bool volume_removable(int volume) | ||
142 | { | ||
143 | /* don't support more than one partition yet, so volume == drive */ | ||
144 | return hostfs_removable(volume); | ||
145 | } | ||
146 | |||
147 | bool volume_present(int volume) | ||
148 | { | ||
149 | /* don't support more than one partition yet, so volume == drive */ | ||
150 | return hostfs_present(volume); | ||
151 | } | ||
152 | #endif | ||
diff --git a/firmware/target/hosted/ibasso/vold-ibasso.c b/firmware/target/hosted/ibasso/vold-ibasso.c index c92b86d364..f56bd683d3 100644 --- a/firmware/target/hosted/ibasso/vold-ibasso.c +++ b/firmware/target/hosted/ibasso/vold-ibasso.c | |||
@@ -45,7 +45,6 @@ | |||
45 | static const char VOLD_MONITOR_SOCKET_NAME[] = "UNIX_domain"; | 45 | static const char VOLD_MONITOR_SOCKET_NAME[] = "UNIX_domain"; |
46 | static int _vold_monitor_socket_fd = -1; | 46 | static int _vold_monitor_socket_fd = -1; |
47 | 47 | ||
48 | |||
49 | static void vold_monitor_open_socket(void) | 48 | static void vold_monitor_open_socket(void) |
50 | { | 49 | { |
51 | TRACE; | 50 | TRACE; |
@@ -82,6 +81,8 @@ static void vold_monitor_open_socket(void) | |||
82 | } | 81 | } |
83 | } | 82 | } |
84 | 83 | ||
84 | /* Track state of external SD */ | ||
85 | bool extsd_present = false; | ||
85 | 86 | ||
86 | /* | 87 | /* |
87 | bionic does not have pthread_cancel. | 88 | bionic does not have pthread_cancel. |
@@ -161,10 +162,12 @@ static void* vold_monitor_run(void* nothing) | |||
161 | else if(strcmp(msg, "Volume sdcard /mnt/external_sd state changed from 4 (Mounted) to 5 (Unmounting)") == 0) | 162 | else if(strcmp(msg, "Volume sdcard /mnt/external_sd state changed from 4 (Mounted) to 5 (Unmounting)") == 0) |
162 | { | 163 | { |
163 | /* We are loosing the external sdcard, inform Rockbox. */ | 164 | /* We are loosing the external sdcard, inform Rockbox. */ |
165 | extsd_present = false; | ||
164 | } | 166 | } |
165 | else if(strcmp(msg, "Volume sdcard /mnt/external_sd state changed from 3 (Checking) to 4 (Mounted)") == 0) | 167 | else if(strcmp(msg, "Volume sdcard /mnt/external_sd state changed from 3 (Checking) to 4 (Mounted)") == 0) |
166 | { | 168 | { |
167 | /* The external sdcard is back, inform Rockbox. */ | 169 | /* The external sdcard is back, inform Rockbox. */ |
170 | extsd_present = true; | ||
168 | } | 171 | } |
169 | } | 172 | } |
170 | } | 173 | } |
diff --git a/firmware/target/hosted/ibasso/vold-ibasso.h b/firmware/target/hosted/ibasso/vold-ibasso.h index 18012b7e16..8c9fd06b99 100644 --- a/firmware/target/hosted/ibasso/vold-ibasso.h +++ b/firmware/target/hosted/ibasso/vold-ibasso.h | |||
@@ -38,5 +38,7 @@ void vold_monitor_start(void); | |||
38 | */ | 38 | */ |
39 | bool vold_monitor_forced_close_imminent(void); | 39 | bool vold_monitor_forced_close_imminent(void); |
40 | 40 | ||
41 | /* Track the state of the SD card */ | ||
42 | extern bool extsd_present; | ||
41 | 43 | ||
42 | #endif | 44 | #endif |