From d5ce38c7b8cc0e326687e1f12494c8657f09e975 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 3 Jul 2002 14:16:20 +0000 Subject: Lame attempt to fix USB polarity auto-detection git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1321 a1c6a512-1295-4272-9138-f99709370657 --- firmware/usb.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'firmware/usb.c') 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]; 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 */ -- cgit v1.2.3