aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2012-02-26 15:01:36 +0000
committerDean Camera <dean@fourwalledcubicle.com>2012-02-26 15:01:36 +0000
commit8a9e30a0cbf5520c112bf2c72248c9eceb8417e4 (patch)
treeb5827b3f240e8521facd7acff0e9ee43790b5ff9 /LUFA/Drivers/USB
parent7cbea39c421d213c81aaf699c521d3a231349b2f (diff)
downloadlufa-8a9e30a0cbf5520c112bf2c72248c9eceb8417e4.tar.gz
lufa-8a9e30a0cbf5520c112bf2c72248c9eceb8417e4.tar.bz2
lufa-8a9e30a0cbf5520c112bf2c72248c9eceb8417e4.zip
Fixed possible enumeration error if the user application selects the non-Control pipe between the Powered and Default states of the host state machine.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r--LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c17
-rw-r--r--LUFA/Drivers/USB/Core/UC3/Host_UC3.c17
2 files changed, 14 insertions, 20 deletions
diff --git a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
index 6d7e9688e..fd311e335 100644
--- a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
+++ b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
@@ -111,11 +111,9 @@ void USB_Host_ProcessNextHostState(void)
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Powered_ConfigPipe);
break;
case HOST_STATE_Powered_ConfigPipe:
- Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
- PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
- PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE);
-
- if (!(Pipe_IsConfigured()))
+ if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
+ PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
+ PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE)))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;
@@ -136,6 +134,7 @@ void USB_Host_ProcessNextHostState(void)
uint8_t DataBuffer[8];
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
if ((SubErrorCode = USB_Host_SendControlRequest(DataBuffer)) != HOST_SENDCONTROL_Successful)
{
ErrorCode = HOST_ENUMERROR_ControlError;
@@ -149,11 +148,9 @@ void USB_Host_ProcessNextHostState(void)
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Default_PostReset);
break;
case HOST_STATE_Default_PostReset:
- Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
- PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
- USB_Host_ControlPipeSize, PIPE_BANK_SINGLE);
-
- if (!(Pipe_IsConfigured()))
+ if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
+ PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
+ USB_Host_ControlPipeSize, PIPE_BANK_SINGLE)))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;
diff --git a/LUFA/Drivers/USB/Core/UC3/Host_UC3.c b/LUFA/Drivers/USB/Core/UC3/Host_UC3.c
index 9d3026614..ef47b6040 100644
--- a/LUFA/Drivers/USB/Core/UC3/Host_UC3.c
+++ b/LUFA/Drivers/USB/Core/UC3/Host_UC3.c
@@ -111,11 +111,9 @@ void USB_Host_ProcessNextHostState(void)
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Powered_ConfigPipe);
break;
case HOST_STATE_Powered_ConfigPipe:
- Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
- PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
- PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE);
-
- if (!(Pipe_IsConfigured()))
+ if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
+ PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
+ PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE)))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;
@@ -136,6 +134,7 @@ void USB_Host_ProcessNextHostState(void)
uint8_t DataBuffer[8];
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
if ((SubErrorCode = USB_Host_SendControlRequest(DataBuffer)) != HOST_SENDCONTROL_Successful)
{
ErrorCode = HOST_ENUMERROR_ControlError;
@@ -149,11 +148,9 @@ void USB_Host_ProcessNextHostState(void)
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Default_PostReset);
break;
case HOST_STATE_Default_PostReset:
- Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
- PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
- USB_Host_ControlPipeSize, PIPE_BANK_SINGLE);
-
- if (!(Pipe_IsConfigured()))
+ if (!(Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
+ PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
+ USB_Host_ControlPipeSize, PIPE_BANK_SINGLE)))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
SubErrorCode = 0;