mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Prevent rebooting in early USB mode in case of a RAM disk
If disk_mount_all() fails at startup, the device should enter USB mode, so the storage can be repartitioned/reformatted. After unmounting/ejecting, the device is rebooted. Unfortunately if the storage is a RAM disk, the data won't persist after a reboot, so this patch tries to mount the storage again, instead of just rebooting. Change-Id: I421a9fd8ae536bee07d292f27d1da0615456df62
This commit is contained in:
parent
e80cf93b67
commit
b3e6b12266
1 changed files with 11 additions and 3 deletions
14
apps/main.c
14
apps/main.c
|
@ -608,7 +608,7 @@ static void init(void)
|
|||
#ifndef USB_NONE
|
||||
lcd_puts(0, 2, "Insert USB cable");
|
||||
lcd_puts(0, 3, "and fix it.");
|
||||
#elif !defined(DEBUG)
|
||||
#elif !defined(DEBUG) && !(CONFIG_STORAGE & STORAGE_RAMDISK)
|
||||
lcd_puts(0, 2, "Rebooting in 5s");
|
||||
#endif
|
||||
lcd_update();
|
||||
|
@ -617,11 +617,19 @@ static void init(void)
|
|||
usb_start_monitoring();
|
||||
while(button_get(true) != SYS_USB_CONNECTED) {};
|
||||
gui_usb_screen_run(true);
|
||||
#else
|
||||
#elif !defined(DEBUG) && !(CONFIG_STORAGE & STORAGE_RAMDISK)
|
||||
sleep(HZ*5);
|
||||
#endif
|
||||
#if !defined(DEBUG)
|
||||
|
||||
#if !defined(DEBUG) && !(CONFIG_STORAGE & STORAGE_RAMDISK)
|
||||
system_reboot();
|
||||
#else
|
||||
rc = disk_mount_all();
|
||||
if (rc <= 0) {
|
||||
lcd_putsf(0, 4, "Error mounting: %08x", rc);
|
||||
lcd_update();
|
||||
sleep(HZ*5);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue