diff options
Diffstat (limited to 'firmware/target/hosted/ibasso')
-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 |
3 files changed, 61 insertions, 1 deletions
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 |