summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-07-03 14:16:20 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-07-03 14:16:20 +0000
commitd5ce38c7b8cc0e326687e1f12494c8657f09e975 (patch)
treeb67024e90fc27593e58dd8cbff17fb29b4b13e29
parentcd890a5e5e69f4e8698779c6b2ccebad04748533 (diff)
downloadrockbox-d5ce38c7b8cc0e326687e1f12494c8657f09e975.zip
rockbox-d5ce38c7b8cc0e326687e1f12494c8657f09e975.tar.gz
rockbox-d5ce38c7b8cc0e326687e1f12494c8657f09e975.tar.bz2
rockbox-d5ce38c7b8cc0e326687e1f12494c8657f09e975.tar.xz
Lame attempt to fix USB polarity auto-detection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1321 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/usb.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/firmware/usb.c b/firmware/usb.c
index 2e118e1..1e45cd3 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -60,14 +60,14 @@ static char usb_stack[0x800];
static struct event_queue usb_queue;
static bool last_usb_status;
static bool usb_monitor_enabled;
+static bool usb_inverted;
static void usb_enable(bool on)
{
-#ifdef ARCHOS_RECORDER
- if(!on) /* The pin is inverted on the Recorder */
-#else
+ if(usb_inverted)
+ on = !on;
+
if(on)
-#endif
PADR &= ~0x400; /* enable USB */
else
PADR |= 0x400;
@@ -252,7 +252,14 @@ void usb_init(void)
usb_state = USB_EXTRACTED;
usb_monitor_enabled = false;
countdown = -1;
-
+
+ /* This is lame. Really lame. We determine the polarity of the USB
+ enable pin by checking how it is set by the Archos firmware. */
+ if(PADR & 0x400)
+ usb_inverted = false;
+ else
+ usb_inverted = true;
+
usb_enable(false);
/* We assume that the USB cable is extracted */