Fix the real issue with AMS bootloader USB mode. A call to usb_enable was missing in usb.c when using the USB stack and USB_DETECT_BY_CORE was not enabled. Try to do it in a clean-ish way.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31245 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7af94b4427
commit
bfd69f2aa1
2 changed files with 15 additions and 8 deletions
|
@ -63,10 +63,8 @@ static void usb_mode(void)
|
||||||
(LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg);
|
(LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg);
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
||||||
usb_enable(true);
|
|
||||||
while(usb_detect() == USB_INSERTED)
|
while(usb_detect() == USB_INSERTED)
|
||||||
sleep(HZ);
|
sleep(HZ);
|
||||||
usb_enable(false);
|
|
||||||
|
|
||||||
reset_screen();
|
reset_screen();
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
|
@ -135,6 +135,11 @@ static inline bool usb_do_screendump(void)
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_USBSTACK
|
#ifdef HAVE_USBSTACK
|
||||||
|
/* Enable / disable USB when the stack is enabled - otherwise a noop */
|
||||||
|
static inline void usb_stack_enable(bool enable)
|
||||||
|
{
|
||||||
|
usb_enable(enable);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_HOTSWAP
|
#ifdef HAVE_HOTSWAP
|
||||||
static inline void usb_handle_hotswap(long id)
|
static inline void usb_handle_hotswap(long id)
|
||||||
|
@ -222,7 +227,6 @@ static inline void usb_slave_mode(bool on)
|
||||||
}
|
}
|
||||||
else /* usb_state == USB_INSERTED (only!) */
|
else /* usb_state == USB_INSERTED (only!) */
|
||||||
{
|
{
|
||||||
usb_enable(false);
|
|
||||||
#ifdef HAVE_PRIORITY_SCHEDULING
|
#ifdef HAVE_PRIORITY_SCHEDULING
|
||||||
thread_set_priority(thread_self(), PRIORITY_SYSTEM);
|
thread_set_priority(thread_self(), PRIORITY_SYSTEM);
|
||||||
#endif
|
#endif
|
||||||
|
@ -254,6 +258,11 @@ void usb_signal_transfer_completion(
|
||||||
|
|
||||||
#else /* !HAVE_USBSTACK */
|
#else /* !HAVE_USBSTACK */
|
||||||
|
|
||||||
|
static inline void usb_stack_enable(bool enable)
|
||||||
|
{
|
||||||
|
(void)enable;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_HOTSWAP
|
#ifdef HAVE_HOTSWAP
|
||||||
static inline void usb_handle_hotswap(long id)
|
static inline void usb_handle_hotswap(long id)
|
||||||
{
|
{
|
||||||
|
@ -403,6 +412,7 @@ static void usb_thread(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
usb_state = USB_POWERED;
|
usb_state = USB_POWERED;
|
||||||
|
usb_stack_enable(true);
|
||||||
#endif /* USB_DETECT_BY_CORE */
|
#endif /* USB_DETECT_BY_CORE */
|
||||||
|
|
||||||
if(usb_power_button())
|
if(usb_power_button())
|
||||||
|
@ -467,20 +477,19 @@ static void usb_thread(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
usb_state = USB_POWERED;
|
usb_state = USB_POWERED;
|
||||||
usb_enable(true);
|
usb_stack_enable(true);
|
||||||
break;
|
break;
|
||||||
/* USB_POWERED: */
|
/* USB_POWERED: */
|
||||||
|
|
||||||
case USB_UNPOWERED:
|
case USB_UNPOWERED:
|
||||||
if(usb_state == USB_POWERED)
|
|
||||||
usb_enable(false);
|
|
||||||
/* Fall-through - other legal states can be USB_INSERTED or
|
|
||||||
USB_SCREENDUMP */
|
|
||||||
#endif /* USB_DETECT_BY_CORE */
|
#endif /* USB_DETECT_BY_CORE */
|
||||||
case USB_EXTRACTED:
|
case USB_EXTRACTED:
|
||||||
if(usb_state == USB_EXTRACTED)
|
if(usb_state == USB_EXTRACTED)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if(usb_state == USB_POWERED || usb_state == USB_INSERTED)
|
||||||
|
usb_stack_enable(false);
|
||||||
|
|
||||||
/* Only disable the USB slave mode if we really have enabled
|
/* Only disable the USB slave mode if we really have enabled
|
||||||
it. Some expected acks may not have been received. */
|
it. Some expected acks may not have been received. */
|
||||||
if(usb_state == USB_INSERTED)
|
if(usb_state == USB_INSERTED)
|
||||||
|
|
Loading…
Reference in a new issue