diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-12-14 09:19:50 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-12-14 09:19:50 +0000 |
commit | bfd69f2aa19321e7fb3dfdd0befcfc7e32eca656 (patch) | |
tree | de136173c7b46650b09b0a07c6a94cb5dd4d1679 /firmware/usb.c | |
parent | 7af94b442741c4bb11a3b42c7c346465bdb30479 (diff) | |
download | rockbox-bfd69f2aa19321e7fb3dfdd0befcfc7e32eca656.tar.gz rockbox-bfd69f2aa19321e7fb3dfdd0befcfc7e32eca656.zip |
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
Diffstat (limited to 'firmware/usb.c')
-rw-r--r-- | firmware/usb.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/firmware/usb.c b/firmware/usb.c index bb19850cae..c7326c548b 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -135,6 +135,11 @@ static inline bool usb_do_screendump(void) | |||
135 | 135 | ||
136 | 136 | ||
137 | #ifdef HAVE_USBSTACK | 137 | #ifdef HAVE_USBSTACK |
138 | /* Enable / disable USB when the stack is enabled - otherwise a noop */ | ||
139 | static inline void usb_stack_enable(bool enable) | ||
140 | { | ||
141 | usb_enable(enable); | ||
142 | } | ||
138 | 143 | ||
139 | #ifdef HAVE_HOTSWAP | 144 | #ifdef HAVE_HOTSWAP |
140 | static inline void usb_handle_hotswap(long id) | 145 | static inline void usb_handle_hotswap(long id) |
@@ -222,7 +227,6 @@ static inline void usb_slave_mode(bool on) | |||
222 | } | 227 | } |
223 | else /* usb_state == USB_INSERTED (only!) */ | 228 | else /* usb_state == USB_INSERTED (only!) */ |
224 | { | 229 | { |
225 | usb_enable(false); | ||
226 | #ifdef HAVE_PRIORITY_SCHEDULING | 230 | #ifdef HAVE_PRIORITY_SCHEDULING |
227 | thread_set_priority(thread_self(), PRIORITY_SYSTEM); | 231 | thread_set_priority(thread_self(), PRIORITY_SYSTEM); |
228 | #endif | 232 | #endif |
@@ -254,6 +258,11 @@ void usb_signal_transfer_completion( | |||
254 | 258 | ||
255 | #else /* !HAVE_USBSTACK */ | 259 | #else /* !HAVE_USBSTACK */ |
256 | 260 | ||
261 | static inline void usb_stack_enable(bool enable) | ||
262 | { | ||
263 | (void)enable; | ||
264 | } | ||
265 | |||
257 | #ifdef HAVE_HOTSWAP | 266 | #ifdef HAVE_HOTSWAP |
258 | static inline void usb_handle_hotswap(long id) | 267 | static inline void usb_handle_hotswap(long id) |
259 | { | 268 | { |
@@ -403,6 +412,7 @@ static void usb_thread(void) | |||
403 | break; | 412 | break; |
404 | 413 | ||
405 | usb_state = USB_POWERED; | 414 | usb_state = USB_POWERED; |
415 | usb_stack_enable(true); | ||
406 | #endif /* USB_DETECT_BY_CORE */ | 416 | #endif /* USB_DETECT_BY_CORE */ |
407 | 417 | ||
408 | if(usb_power_button()) | 418 | if(usb_power_button()) |
@@ -467,20 +477,19 @@ static void usb_thread(void) | |||
467 | break; | 477 | break; |
468 | 478 | ||
469 | usb_state = USB_POWERED; | 479 | usb_state = USB_POWERED; |
470 | usb_enable(true); | 480 | usb_stack_enable(true); |
471 | break; | 481 | break; |
472 | /* USB_POWERED: */ | 482 | /* USB_POWERED: */ |
473 | 483 | ||
474 | case USB_UNPOWERED: | 484 | case USB_UNPOWERED: |
475 | if(usb_state == USB_POWERED) | ||
476 | usb_enable(false); | ||
477 | /* Fall-through - other legal states can be USB_INSERTED or | ||
478 | USB_SCREENDUMP */ | ||
479 | #endif /* USB_DETECT_BY_CORE */ | 485 | #endif /* USB_DETECT_BY_CORE */ |
480 | case USB_EXTRACTED: | 486 | case USB_EXTRACTED: |
481 | if(usb_state == USB_EXTRACTED) | 487 | if(usb_state == USB_EXTRACTED) |
482 | break; | 488 | break; |
483 | 489 | ||
490 | if(usb_state == USB_POWERED || usb_state == USB_INSERTED) | ||
491 | usb_stack_enable(false); | ||
492 | |||
484 | /* Only disable the USB slave mode if we really have enabled | 493 | /* Only disable the USB slave mode if we really have enabled |
485 | it. Some expected acks may not have been received. */ | 494 | it. Some expected acks may not have been received. */ |
486 | if(usb_state == USB_INSERTED) | 495 | if(usb_state == USB_INSERTED) |