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
This commit is contained in:
Solomon Peachy 2024-06-11 10:14:36 -04:00
parent ec23260fd1
commit 4d9c7e2063

View file

@ -141,7 +141,7 @@
#if defined(WIN32) #if defined(WIN32)
#undef main #undef main
#endif #endif
#endif #endif /* SDL|MAEMO|PAMDORA */
/*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
@ -432,7 +432,7 @@ static void init(void)
#endif #endif
} }
#else /* CONFIG_PLATFORM & PLATFORM_HOSTED */ #else /* ! (CONFIG_PLATFORM & PLATFORM_HOSTED) */
#include "errno.h" #include "errno.h"
@ -551,7 +551,7 @@ static void init(void)
{ {
lcd_clear_display(); lcd_clear_display();
lcd_putsf(0, 1, "ATA error: %d", rc); 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(); lcd_update();
while(!(button_get(true) & BUTTON_REL)); /* DO NOT CHANGE TO ACTION SYSTEM */ while(!(button_get(true) & BUTTON_REL)); /* DO NOT CHANGE TO ACTION SYSTEM */
dbg_ports(); dbg_ports();
@ -605,13 +605,24 @@ static void init(void)
lcd_clear_display(); lcd_clear_display();
lcd_puts(0, 0, "No partition"); lcd_puts(0, 0, "No partition");
lcd_puts(0, 1, "found."); lcd_puts(0, 1, "found.");
#ifndef USB_NONE
lcd_puts(0, 2, "Insert USB cable"); lcd_puts(0, 2, "Insert USB cable");
lcd_puts(0, 3, "and fix it."); lcd_puts(0, 3, "and fix it.");
#elif !defined(DEBUG)
lcd_puts(0, 2, "Rebooting in 5s");
#endif
lcd_update(); lcd_update();
#ifndef USB_NONE
usb_start_monitoring();
while(button_get(true) != SYS_USB_CONNECTED) {}; while(button_get(true) != SYS_USB_CONNECTED) {};
gui_usb_screen_run(true); gui_usb_screen_run(true);
#else
sleep(HZ*5);
#endif
#if !defined(DEBUG)
system_reboot(); system_reboot();
#endif
} }
} }