diff options
Diffstat (limited to 'apps/main.c')
-rw-r--r-- | apps/main.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/apps/main.c b/apps/main.c index 25bc9296e5..537c3da4dc 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -127,6 +127,7 @@ void init(void) | |||
127 | void init(void) | 127 | void init(void) |
128 | { | 128 | { |
129 | int rc; | 129 | int rc; |
130 | bool mounted = false; | ||
130 | #if defined(HAVE_CHARGING) && (CONFIG_CPU == SH7034) | 131 | #if defined(HAVE_CHARGING) && (CONFIG_CPU == SH7034) |
131 | /* if nobody initialized ATA before, I consider this a cold start */ | 132 | /* if nobody initialized ATA before, I consider this a cold start */ |
132 | bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */ | 133 | bool coldstart = (PACR2 & 0x4000) != 0; /* starting from Flash */ |
@@ -216,22 +217,35 @@ void init(void) | |||
216 | } | 217 | } |
217 | 218 | ||
218 | usb_start_monitoring(); | 219 | usb_start_monitoring(); |
220 | while (usb_detect()) | ||
221 | { /* enter USB mode early, before trying to mount */ | ||
222 | if (button_get_w_tmo(HZ/10) == SYS_USB_CONNECTED) | ||
223 | #ifdef HAVE_MMC | ||
224 | if (!mmc_touched() || (mmc_remove_request() == SYS_MMC_EXTRACTED)) | ||
225 | #endif | ||
226 | { | ||
227 | usb_screen(); | ||
228 | mounted = true; /* mounting done @ end of USB mode */ | ||
229 | } | ||
230 | } | ||
219 | 231 | ||
220 | /* FixMe: the same kind of mounting happens in usb.c, share the code. */ | 232 | if (!mounted) |
221 | rc = disk_mount_all(); | ||
222 | if (rc<=0) | ||
223 | { | 233 | { |
224 | lcd_clear_display(); | 234 | rc = disk_mount_all(); |
225 | lcd_puts(0, 0, "No partition"); | 235 | if (rc<=0) |
226 | lcd_puts(0, 1, "found."); | 236 | { |
237 | lcd_clear_display(); | ||
238 | lcd_puts(0, 0, "No partition"); | ||
239 | lcd_puts(0, 1, "found."); | ||
227 | #ifdef HAVE_LCD_BITMAP | 240 | #ifdef HAVE_LCD_BITMAP |
228 | lcd_puts(0, 2, "Insert USB cable"); | 241 | lcd_puts(0, 2, "Insert USB cable"); |
229 | lcd_puts(0, 3, "and fix it."); | 242 | lcd_puts(0, 3, "and fix it."); |
230 | lcd_update(); | 243 | lcd_update(); |
231 | #endif | 244 | #endif |
232 | while(button_get(true) != SYS_USB_CONNECTED) {}; | 245 | while(button_get(true) != SYS_USB_CONNECTED) {}; |
233 | usb_screen(); | 246 | usb_screen(); |
234 | system_reboot(); | 247 | system_reboot(); |
248 | } | ||
235 | } | 249 | } |
236 | 250 | ||
237 | settings_calc_config_sector(); | 251 | settings_calc_config_sector(); |