diff options
Diffstat (limited to 'uisimulator/common')
-rw-r--r-- | uisimulator/common/sim_tasks.c | 58 | ||||
-rw-r--r-- | uisimulator/common/sim_tasks.h | 1 | ||||
-rw-r--r-- | uisimulator/common/stubs.c | 7 |
3 files changed, 59 insertions, 7 deletions
diff --git a/uisimulator/common/sim_tasks.c b/uisimulator/common/sim_tasks.c index 46e893b437..1299a69302 100644 --- a/uisimulator/common/sim_tasks.c +++ b/uisimulator/common/sim_tasks.c | |||
@@ -40,6 +40,10 @@ enum { | |||
40 | SIM_SCREENDUMP, | 40 | SIM_SCREENDUMP, |
41 | SIM_USB_INSERTED, | 41 | SIM_USB_INSERTED, |
42 | SIM_USB_EXTRACTED, | 42 | SIM_USB_EXTRACTED, |
43 | #ifdef HAVE_MULTIDRIVE | ||
44 | SIM_EXT_INSERTED, | ||
45 | SIM_EXT_EXTRACTED, | ||
46 | #endif | ||
43 | }; | 47 | }; |
44 | 48 | ||
45 | void sim_thread(void) | 49 | void sim_thread(void) |
@@ -95,6 +99,15 @@ void sim_thread(void) | |||
95 | * do it here anyway but don't depend on the acks */ | 99 | * do it here anyway but don't depend on the acks */ |
96 | queue_broadcast(SYS_USB_DISCONNECTED, 0); | 100 | queue_broadcast(SYS_USB_DISCONNECTED, 0); |
97 | break; | 101 | break; |
102 | #ifdef HAVE_MULTIDRIVE | ||
103 | case SIM_EXT_INSERTED: | ||
104 | case SIM_EXT_EXTRACTED: | ||
105 | queue_broadcast(ev.id == SIM_EXT_INSERTED ? | ||
106 | SYS_HOTSWAP_INSERTED : SYS_HOTSWAP_EXTRACTED, 0); | ||
107 | sleep(HZ/20); | ||
108 | queue_broadcast(SYS_FS_CHANGED, 0); | ||
109 | break; | ||
110 | #endif /* HAVE_MULTIDRIVE */ | ||
98 | default: | 111 | default: |
99 | DEBUGF("sim_tasks: unhandled event: %ld\n", ev.id); | 112 | DEBUGF("sim_tasks: unhandled event: %ld\n", ev.id); |
100 | break; | 113 | break; |
@@ -155,3 +168,48 @@ void usb_wait_for_disconnect(struct event_queue *q) | |||
155 | return; | 168 | return; |
156 | } | 169 | } |
157 | } | 170 | } |
171 | |||
172 | #ifdef HAVE_MULTIDRIVE | ||
173 | static bool is_ext_inserted; | ||
174 | |||
175 | void sim_trigger_external(bool inserted) | ||
176 | { | ||
177 | if (inserted) | ||
178 | queue_post(&sim_queue, SIM_EXT_INSERTED, 0); | ||
179 | else | ||
180 | queue_post(&sim_queue, SIM_EXT_EXTRACTED, 0); | ||
181 | is_ext_inserted = inserted; | ||
182 | } | ||
183 | |||
184 | bool hostfs_present(int drive) | ||
185 | { | ||
186 | return drive > 0 ? is_ext_inserted : true; | ||
187 | } | ||
188 | |||
189 | bool hostfs_removable(int drive) | ||
190 | { | ||
191 | return drive > 0; | ||
192 | } | ||
193 | |||
194 | #ifdef HAVE_MULTIVOLUME | ||
195 | bool volume_removable(int volume) | ||
196 | { | ||
197 | /* volume == drive for now */ | ||
198 | return hostfs_removable(volume); | ||
199 | } | ||
200 | |||
201 | bool volume_present(int volume) | ||
202 | { | ||
203 | /* volume == drive for now */ | ||
204 | return hostfs_present(volume); | ||
205 | } | ||
206 | #endif | ||
207 | |||
208 | #if (CONFIG_STORAGE & STORAGE_MMC) | ||
209 | bool mmc_touched(void) | ||
210 | { | ||
211 | return hostfs_present(1); | ||
212 | } | ||
213 | #endif | ||
214 | |||
215 | #endif | ||
diff --git a/uisimulator/common/sim_tasks.h b/uisimulator/common/sim_tasks.h index dfecd4448e..2bcd09d114 100644 --- a/uisimulator/common/sim_tasks.h +++ b/uisimulator/common/sim_tasks.h | |||
@@ -28,5 +28,6 @@ | |||
28 | void sim_tasks_init(void); | 28 | void sim_tasks_init(void); |
29 | void sim_trigger_screendump(void); | 29 | void sim_trigger_screendump(void); |
30 | void sim_trigger_usb(bool inserted); | 30 | void sim_trigger_usb(bool inserted); |
31 | void sim_trigger_external(bool inserted); | ||
31 | 32 | ||
32 | #endif | 33 | #endif |
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index 480c2a90d8..18f60ce6b3 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c | |||
@@ -395,10 +395,3 @@ void touchpad_enable_device(bool en) | |||
395 | (void)en; | 395 | (void)en; |
396 | } | 396 | } |
397 | #endif | 397 | #endif |
398 | |||
399 | #if (CONFIG_STORAGE & STORAGE_MMC) | ||
400 | bool mmc_touched(void) | ||
401 | { | ||
402 | return false; | ||
403 | } | ||
404 | #endif | ||