summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2005-07-10 05:11:07 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2005-07-10 05:11:07 +0000
commit1a7f1f44c7e1b3536c01259ba3dbe03c782ac9a6 (patch)
treeb2c8b7160a3be8a9e80403524fd57a45e8fb0f8c
parent85e03767f7f59eabfdb2e6aaffdebb63e48a0d00 (diff)
downloadrockbox-1a7f1f44c7e1b3536c01259ba3dbe03c782ac9a6.tar.gz
rockbox-1a7f1f44c7e1b3536c01259ba3dbe03c782ac9a6.zip
improvements suggested by Jens: prompt for USB in case of problems, handle power off button
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7089 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--flash/bootbox/main.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/flash/bootbox/main.c b/flash/bootbox/main.c
index b0350923f3..8c7c398ff8 100644
--- a/flash/bootbox/main.c
+++ b/flash/bootbox/main.c
@@ -42,7 +42,11 @@
#include "usb.h"
#include "powermgmt.h"
-int line = 0;
+#ifdef BUTTON_OFF
+ static const int offbutton = BUTTON_OFF;
+#else
+ static const int offbutton = BUTTON_STOP;
+#endif
void usb_screen(void)
{
@@ -72,11 +76,6 @@ int charging_screen(void)
{
unsigned int button;
int rc = 0;
-#ifdef BUTTON_OFF
- const unsigned int offbutton = BUTTON_OFF;
-#else
- const unsigned int offbutton = BUTTON_STOP;
-#endif
ide_power_enable(false); /* power down the disk, else would be spinning */
@@ -119,6 +118,29 @@ int mmc_remove_request(void)
}
#endif /* HAVE_MMC */
+/* prompt user to plug USB and fix a problem */
+void prompt_usb(const char* msg1, const char* msg2)
+{
+ int button;
+ lcd_clear_display();
+ lcd_puts(0, 0, msg1);
+ lcd_puts(0, 1, msg2);
+#ifdef HAVE_LCD_BITMAP
+ lcd_puts(0, 2, "Insert USB cable");
+ lcd_puts(0, 3, "and fix it.");
+ lcd_update();
+#endif
+ do
+ {
+ button = button_get(true);
+ if (button == offbutton)
+ {
+ power_off();
+ }
+ } while (button != SYS_USB_CONNECTED);
+ usb_screen();
+ system_reboot();
+}
void main(void)
{
@@ -178,31 +200,14 @@ void main(void)
rc = disk_mount_all();
if (rc<=0)
{
- lcd_clear_display();
- lcd_puts(0, 0, "No partition");
- lcd_puts(0, 1, "found.");
-#ifdef HAVE_LCD_BITMAP
- lcd_puts(0, 2, "Insert USB cable");
- lcd_puts(0, 3, "and fix it.");
- lcd_update();
-#endif
- while(button_get(true) != SYS_USB_CONNECTED) {};
- usb_screen();
- system_reboot();
+ prompt_usb("No partition", "found.");
}
{ // rolo the firmware
static const char filename[] = "/" BOOTFILE;
rolo_load((char*)filename); /* won't return if started */
- lcd_clear_display();
- lcd_puts(0, 0, "No firmware");
- lcd_puts(0, 1, filename);
-#ifdef HAVE_LCD_BITMAP
- lcd_update();
-#endif
- while(!(button_get(true) & BUTTON_REL));
- system_reboot();
+ prompt_usb("No firmware", filename);
}