Index: bootloader/ipod.c =================================================================== --- bootloader/ipod.c (revision 14604) +++ bootloader/ipod.c (working copy) @@ -41,6 +41,8 @@ #include "file.h" #include "common.h" #include "hwcompat.h" +#include "usb-target.h" +#include "usb.h" #define XSC(X) #X #define SC(X) XSC(X) @@ -270,6 +272,28 @@ printf("Version: %s", version); printf("IPOD version: 0x%08x", IPOD_HW_REVISION); +#if !defined(IPOD_1G2G) +#if defined(IPOD_VIDEO) || defined (IPOD_NANO) + if (GPIOL_INPUT_VAL & 0x10) +#elif defined(IPOD_3G) + if (GPIOC_INPUT_VAL & 0x60) +#else /* 4g, mini etc */ + if (GPIOC_INPUT_VAL & 0x50) +#endif + { + usb_init_device(); + + int usb_retry = 0; + while (usb_retry < 5) + { + usb_retry++; + sleep(HZ/4); + if (usb_detect() == USB_INSERTED) + usb_enable(true); + } + } +#endif /* !defined(IPOD_1G2G) */ + i=ata_init(); if (i==0) { identify_info=ata_get_identify(); @@ -362,10 +386,12 @@ /* These functions are present in the firmware library, but we reimplement them here because the originals do a lot more than we want */ -void usb_acknowledge(void) +void usb_acknowledge(long id) { + (void)id; } -void usb_wait_for_disconnect(void) +void usb_wait_for_disconnect(struct event_queue *q) { + (void)q; } Index: firmware/export/usb.h =================================================================== --- firmware/export/usb.h (revision 14604) +++ firmware/export/usb.h (working copy) @@ -20,7 +20,9 @@ #define _USB_H_ #include "kernel.h" +#ifndef BOOTLOADER #include "button.h" +#endif /* Messages from usb_tick and thread states */ #define USB_INSERTED 1 Index: firmware/SOURCES =================================================================== --- firmware/SOURCES (revision 14604) +++ firmware/SOURCES (working copy) @@ -239,7 +239,7 @@ #if CONFIG_USBOTG == USBOTG_ISP1362 drivers/isp1362.c #endif -#if defined(SANSA_E200) || !defined(BOOTLOADER) +#if defined(SANSA_E200) || defined (USB_IPODSTYLE) || !defined(BOOTLOADER) #if CONFIG_USBOTG == USBOTG_M5636 drivers/m5636.c #elif CONFIG_USBOTG == USBOTG_ARC Index: firmware/target/arm/ipod/button-clickwheel.c =================================================================== --- firmware/target/arm/ipod/button-clickwheel.c (revision 14604) +++ firmware/target/arm/ipod/button-clickwheel.c (working copy) @@ -232,10 +232,12 @@ return int_btn; } +#ifndef BOOTLOADER bool button_hold(void) { return (GPIOA_INPUT_VAL & 0x20)?false:true; } +#endif bool headphones_inserted(void) {