From 4d9c7e20632ee9c98cf73c7c3751b9f495a720d8 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 11 Jun 2024 10:14:36 -0400 Subject: Improve the "No partition found" behavior. (This is a different implementation of the fix in g#5726, by Vencislav Atanasov) The core problem is that the user is prompted to insert a USB cable to fix the partitioning etc but the code that monitors for USB insertion hasn't been started yet. Correct this. If no USB support is present, reboot after 5 seconds if it's not a debug build. If USB support is present, want for insertion first, then do the reboot-if-not-debug behavior. Change-Id: I87827e7fe2fe9a02298918c6ebc4d8a9fb33d624 --- apps/main.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'apps/main.c') diff --git a/apps/main.c b/apps/main.c index cf7d302fc9..edeeed7d8a 100644 --- a/apps/main.c +++ b/apps/main.c @@ -141,7 +141,7 @@ #if defined(WIN32) #undef main #endif -#endif +#endif /* SDL|MAEMO|PAMDORA */ /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ @@ -432,7 +432,7 @@ static void init(void) #endif } -#else /* CONFIG_PLATFORM & PLATFORM_HOSTED */ +#else /* ! (CONFIG_PLATFORM & PLATFORM_HOSTED) */ #include "errno.h" @@ -551,7 +551,7 @@ static void init(void) { lcd_clear_display(); lcd_putsf(0, 1, "ATA error: %d", rc); - lcd_puts(0, 3, "Press ON to debug"); + lcd_puts(0, 3, "Press button to debug"); lcd_update(); while(!(button_get(true) & BUTTON_REL)); /* DO NOT CHANGE TO ACTION SYSTEM */ dbg_ports(); @@ -605,13 +605,24 @@ static void init(void) lcd_clear_display(); lcd_puts(0, 0, "No partition"); lcd_puts(0, 1, "found."); +#ifndef USB_NONE lcd_puts(0, 2, "Insert USB cable"); lcd_puts(0, 3, "and fix it."); +#elif !defined(DEBUG) + lcd_puts(0, 2, "Rebooting in 5s"); +#endif lcd_update(); +#ifndef USB_NONE + usb_start_monitoring(); while(button_get(true) != SYS_USB_CONNECTED) {}; gui_usb_screen_run(true); +#else + sleep(HZ*5); +#endif +#if !defined(DEBUG) system_reboot(); +#endif } } -- cgit v1.2.3