diff options
-rw-r--r-- | firmware/usb.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/firmware/usb.c b/firmware/usb.c index 2e118e176c..1e45cd34b8 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -60,14 +60,14 @@ static char usb_stack[0x800]; | |||
60 | static struct event_queue usb_queue; | 60 | static struct event_queue usb_queue; |
61 | static bool last_usb_status; | 61 | static bool last_usb_status; |
62 | static bool usb_monitor_enabled; | 62 | static bool usb_monitor_enabled; |
63 | static bool usb_inverted; | ||
63 | 64 | ||
64 | static void usb_enable(bool on) | 65 | static void usb_enable(bool on) |
65 | { | 66 | { |
66 | #ifdef ARCHOS_RECORDER | 67 | if(usb_inverted) |
67 | if(!on) /* The pin is inverted on the Recorder */ | 68 | on = !on; |
68 | #else | 69 | |
69 | if(on) | 70 | if(on) |
70 | #endif | ||
71 | PADR &= ~0x400; /* enable USB */ | 71 | PADR &= ~0x400; /* enable USB */ |
72 | else | 72 | else |
73 | PADR |= 0x400; | 73 | PADR |= 0x400; |
@@ -252,7 +252,14 @@ void usb_init(void) | |||
252 | usb_state = USB_EXTRACTED; | 252 | usb_state = USB_EXTRACTED; |
253 | usb_monitor_enabled = false; | 253 | usb_monitor_enabled = false; |
254 | countdown = -1; | 254 | countdown = -1; |
255 | 255 | ||
256 | /* This is lame. Really lame. We determine the polarity of the USB | ||
257 | enable pin by checking how it is set by the Archos firmware. */ | ||
258 | if(PADR & 0x400) | ||
259 | usb_inverted = false; | ||
260 | else | ||
261 | usb_inverted = true; | ||
262 | |||
256 | usb_enable(false); | 263 | usb_enable(false); |
257 | 264 | ||
258 | /* We assume that the USB cable is extracted */ | 265 | /* We assume that the USB cable is extracted */ |