FS#11199: ipod bootloader: reboot to disk mode on cable insert, following a fatal error

If the ipod bootloader dies with a fatal error it prompts you to press buttons to reset and enter disk mode. With this change it now also polls for USB/firewire insertion and if the cable is detected, it reboots to disk mode directly for you, avoiding user problems with rebooting correctly by hand.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25643 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Torne Wuff 2010-04-13 22:17:42 +00:00
parent bab1558900
commit 0d24df8b95

View file

@ -43,6 +43,7 @@
#include "file.h"
#include "common.h"
#include "hwcompat.h"
#include "usb.h"
#define XSC(X) #X
#define SC(X) XSC(X)
@ -58,12 +59,6 @@ unsigned char *loadbuffer = (unsigned char *)DRAM_START;
/* Bootloader version */
char version[] = APPSVERSION;
#define BUTTON_LEFT 1
#define BUTTON_MENU 2
#define BUTTON_RIGHT 3
#define BUTTON_PLAY 4
#define BUTTON_HOLD 5
#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
/* check if number of seconds has past */
int timer_check(int clock_start, unsigned int usecs)
@ -193,19 +188,22 @@ void fatal_error(void)
/* System font is 6 pixels wide */
#if defined(IPOD_1G2G) || defined(IPOD_3G)
printf("Hold MENU+PLAY to");
printf("reboot then REW+FF");
printf("for disk mode");
printf("Insert Firewire cable, or");
printf("hold MENU+PLAY to reboot");
printf("then REW+FF for disk mode");
#elif LCD_WIDTH >= (30*6)
printf("Hold MENU+SELECT to reboot");
printf("Insert USB cable, or");
printf("hold MENU+SELECT to reboot");
printf("then SELECT+PLAY for disk mode");
#else
printf("Hold MENU+SELECT to");
printf("Insert USB cable, or");
printf("hold MENU+SELECT to");
printf("reboot then SELECT+PLAY");
printf("for disk mode");
#endif
lcd_update();
usb_init();
while (1) {
if (button_hold() != holdstatus) {
if (button_hold()) {
@ -217,6 +215,18 @@ void fatal_error(void)
}
lcd_update();
}
if (usb_detect() == USB_INSERTED) {
ata_sleepnow(); /* Immediately spindown the disk. */
sleep(HZ*2);
#if CONFIG_CPU == PP5020
memcpy((void *)0x40017f00, "diskmode\0\0hotstuff\0\0\1", 21);
#elif CONFIG_CPU == PP5022
memcpy((void *)0x4001ff00, "diskmode\0\0hotstuff\0\0\1", 21);
#elif CONFIG_CPU == PP5002
memcpy((void *)0x40017f00, "diskmodehotstuff\1", 17);
#endif /* CONFIG_CPU */
system_reboot(); /* Reboot */
}
udelay(100000); /* 100ms */
}