diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-09-19 06:30:14 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-09-19 06:30:14 +0000 |
commit | d66a925786e4e57713a2c902cdffe7269db43226 (patch) | |
tree | 84595e68fc0ca6833fdc84bc4a0ecdb4d14a43c2 /LUFA | |
parent | b17e87d1406f8d193ddd2a0700081d24e8bcffcc (diff) | |
download | lufa-d66a925786e4e57713a2c902cdffe7269db43226.tar.gz lufa-d66a925786e4e57713a2c902cdffe7269db43226.tar.bz2 lufa-d66a925786e4e57713a2c902cdffe7269db43226.zip |
Make device mode configure the control endpoint even before the bus has been reset, so that the device will enumerate correctly on hosts that do not reset the device before initial use.
Diffstat (limited to 'LUFA')
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/USBController.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/USBController.c b/LUFA/Drivers/USB/LowLevel/USBController.c index 49bd05b64..f7207778c 100644 --- a/LUFA/Drivers/USB/LowLevel/USBController.c +++ b/LUFA/Drivers/USB/LowLevel/USBController.c @@ -60,6 +60,11 @@ void USB_Init( USB_Options = Options; #endif + if (!(USB_Options & USB_OPT_REG_DISABLED)) + USB_REG_On(); + else + USB_REG_Off(); + #if defined(USB_CAN_BE_BOTH) if (Mode == USB_MODE_UID) { @@ -112,11 +117,6 @@ void USB_ResetInterface(void) USB_INT_ClearAllInterrupts(); USB_Controller_Reset(); - - if (!(USB_Options & USB_OPT_REG_DISABLED)) - USB_REG_On(); - else - USB_REG_Off(); if (!(USB_Options & USB_OPT_MANUAL_PLL)) { @@ -126,9 +126,7 @@ void USB_ResetInterface(void) USB_PLL_On(); while (!(USB_PLL_IsReady())); - } - - USB_CLK_Unfreeze(); + } #if defined(USB_CAN_BE_BOTH) if (UIDModeSelectEnabled) @@ -137,6 +135,8 @@ void USB_ResetInterface(void) USB_INT_Enable(USB_INT_IDTI); } #endif + + USB_CLK_Unfreeze(); if (USB_CurrentMode == USB_MODE_DEVICE) { @@ -159,8 +159,6 @@ void USB_ResetInterface(void) #if (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) USB_OTGPAD_On(); #endif - - USB_Attach(); } #if defined(USB_CAN_BE_DEVICE) @@ -201,10 +199,14 @@ static void USB_Init_Device(void) USB_INT_Enable(USB_INT_VBUS); #endif - USB_INT_Clear(USB_INT_SUSPEND); + Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, + ENDPOINT_DIR_OUT, USB_ControlEndpointSize, + ENDPOINT_BANK_SINGLE); + USB_INT_Enable(USB_INT_SUSPEND); - USB_INT_Clear(USB_INT_EORSTI); USB_INT_Enable(USB_INT_EORSTI); + + USB_Attach(); } #endif |