summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2021-04-11 09:10:55 -0400
committerSolomon Peachy <pizza@shaftnet.org>2021-04-12 18:19:06 +0000
commitb6fce99046a3677f27373f8c701e6f200e290236 (patch)
tree9ea27b619af5962e415a52ceffaffc35aabd3c47
parente4345f2db8771fb773e07daf1a9f7bfac961c6bd (diff)
downloadrockbox-b6fce99046a3677f27373f8c701e6f200e290236.tar.gz
rockbox-b6fce99046a3677f27373f8c701e6f200e290236.zip
ibasso: Implement proper PIVOT_ROOT filesystem access
Including direct use of the external SD card mount Known issue: If SD card is inserted at startup, it must be ejected and reinserted to be registered. Change-Id: I5f420160bda32135cbb088c1e8b04b6e3a73018e
-rw-r--r--firmware/export/config/ibassodx50.h9
-rw-r--r--firmware/export/config/ibassodx90.h9
-rw-r--r--firmware/target/hosted/ibasso/system-ibasso.c55
-rw-r--r--firmware/target/hosted/ibasso/vold-ibasso.c5
-rw-r--r--firmware/target/hosted/ibasso/vold-ibasso.h2
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 @@
39uintptr_t* stackbegin; 40uintptr_t* stackbegin;
40uintptr_t* stackend; 41uintptr_t* stackend;
41 42
43/* forward-declare */
44bool os_file_exists(const char *ospath);
42 45
43void system_init(void) 46void 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
102bool 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
113int volume_drive(int drive)
114{
115 return drive;
116}
117#endif /* HAVE_MULTIDRIVE */
118
119#ifdef CONFIG_STORAGE_MULTI
120int hostfs_driver_type(int drive)
121{
122 return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM;
123}
124#endif /* CONFIG_STORAGE_MULTI */
125
126bool 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
141bool volume_removable(int volume)
142{
143 /* don't support more than one partition yet, so volume == drive */
144 return hostfs_removable(volume);
145}
146
147bool 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 @@
45static const char VOLD_MONITOR_SOCKET_NAME[] = "UNIX_domain"; 45static const char VOLD_MONITOR_SOCKET_NAME[] = "UNIX_domain";
46static int _vold_monitor_socket_fd = -1; 46static int _vold_monitor_socket_fd = -1;
47 47
48
49static void vold_monitor_open_socket(void) 48static 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 */
85bool 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*/
39bool vold_monitor_forced_close_imminent(void); 39bool vold_monitor_forced_close_imminent(void);
40 40
41/* Track the state of the SD card */
42extern bool extsd_present;
41 43
42#endif 44#endif