summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVencislav Atanasov <user890104@freemyipod.org>2024-06-18 18:17:40 +0300
committerSolomon Peachy <pizza@shaftnet.org>2024-06-18 20:45:40 -0400
commitb3e6b122662a696494a2c325c69d33b3856167ad (patch)
tree2832910d1ecd565e614d80de84d95f6ff6836fdb
parente80cf93b67eba00df7dcd35f6ec972e66a5a5e84 (diff)
downloadrockbox-b3e6b12266.tar.gz
rockbox-b3e6b12266.zip
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
-rw-r--r--apps/main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/main.c b/apps/main.c
index edeeed7d8a..20b9a0bc55 100644
--- a/apps/main.c
+++ b/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
}
}