summaryrefslogtreecommitdiff
path: root/flash
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 /flash
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
Diffstat (limited to 'flash')
-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 @@
42#include "usb.h" 42#include "usb.h"
43#include "powermgmt.h" 43#include "powermgmt.h"
44 44
45int line = 0; 45#ifdef BUTTON_OFF
46 static const int offbutton = BUTTON_OFF;
47#else
48 static const int offbutton = BUTTON_STOP;
49#endif
46 50
47void usb_screen(void) 51void usb_screen(void)
48{ 52{
@@ -72,11 +76,6 @@ int charging_screen(void)
72{ 76{
73 unsigned int button; 77 unsigned int button;
74 int rc = 0; 78 int rc = 0;
75#ifdef BUTTON_OFF
76 const unsigned int offbutton = BUTTON_OFF;
77#else
78 const unsigned int offbutton = BUTTON_STOP;
79#endif
80 79
81 ide_power_enable(false); /* power down the disk, else would be spinning */ 80 ide_power_enable(false); /* power down the disk, else would be spinning */
82 81
@@ -119,6 +118,29 @@ int mmc_remove_request(void)
119} 118}
120#endif /* HAVE_MMC */ 119#endif /* HAVE_MMC */
121 120
121/* prompt user to plug USB and fix a problem */
122void prompt_usb(const char* msg1, const char* msg2)
123{
124 int button;
125 lcd_clear_display();
126 lcd_puts(0, 0, msg1);
127 lcd_puts(0, 1, msg2);
128#ifdef HAVE_LCD_BITMAP
129 lcd_puts(0, 2, "Insert USB cable");
130 lcd_puts(0, 3, "and fix it.");
131 lcd_update();
132#endif
133 do
134 {
135 button = button_get(true);
136 if (button == offbutton)
137 {
138 power_off();
139 }
140 } while (button != SYS_USB_CONNECTED);
141 usb_screen();
142 system_reboot();
143}
122 144
123void main(void) 145void main(void)
124{ 146{
@@ -178,31 +200,14 @@ void main(void)
178 rc = disk_mount_all(); 200 rc = disk_mount_all();
179 if (rc<=0) 201 if (rc<=0)
180 { 202 {
181 lcd_clear_display(); 203 prompt_usb("No partition", "found.");
182 lcd_puts(0, 0, "No partition");
183 lcd_puts(0, 1, "found.");
184#ifdef HAVE_LCD_BITMAP
185 lcd_puts(0, 2, "Insert USB cable");
186 lcd_puts(0, 3, "and fix it.");
187 lcd_update();
188#endif
189 while(button_get(true) != SYS_USB_CONNECTED) {};
190 usb_screen();
191 system_reboot();
192 } 204 }
193 205
194 { // rolo the firmware 206 { // rolo the firmware
195 static const char filename[] = "/" BOOTFILE; 207 static const char filename[] = "/" BOOTFILE;
196 rolo_load((char*)filename); /* won't return if started */ 208 rolo_load((char*)filename); /* won't return if started */
197 209
198 lcd_clear_display(); 210 prompt_usb("No firmware", filename);
199 lcd_puts(0, 0, "No firmware");
200 lcd_puts(0, 1, filename);
201#ifdef HAVE_LCD_BITMAP
202 lcd_update();
203#endif
204 while(!(button_get(true) & BUTTON_REL));
205 system_reboot();
206 } 211 }
207 212
208 213