Minor correction to the DevChapter9.c handling of Set and Clear feature requests -- remote wake up requests now complete correctly rather than stalling the request.

This commit is contained in:
Dean Camera 2009-05-06 13:17:38 +00:00
parent a908773a13
commit 2bd88ebc4f
1 changed files with 26 additions and 19 deletions

View File

@ -274,6 +274,8 @@ static void USB_Device_ClearSetFeature(void)
case REQREC_DEVICE:
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_REMOTE_WAKEUP)
USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
else
return;
break;
#if !defined(CONTROL_ONLY_DEVICE)
@ -282,33 +284,38 @@ static void USB_Device_ClearSetFeature(void)
{
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
if (EndpointIndex != ENDPOINT_CONTROLEP)
{
Endpoint_SelectEndpoint(EndpointIndex);
if (EndpointIndex == ENDPOINT_CONTROLEP)
return;
if (Endpoint_IsEnabled())
{
if (USB_ControlRequest.bRequest == REQ_ClearFeature)
{
Endpoint_ClearStall();
Endpoint_ResetFIFO(EndpointIndex);
Endpoint_ResetDataToggle();
}
else
{
Endpoint_StallTransaction();
}
Endpoint_SelectEndpoint(EndpointIndex);
if (Endpoint_IsEnabled())
{
if (USB_ControlRequest.bRequest == REQ_ClearFeature)
{
Endpoint_ClearStall();
Endpoint_ResetFIFO(EndpointIndex);
Endpoint_ResetDataToggle();
}
else
{
Endpoint_StallTransaction();
}
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
Endpoint_ClearSETUP();
Endpoint_ClearIN();
}
}
break;
#endif
}
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
Endpoint_ClearSETUP();
Endpoint_ClearIN();
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearOUT();
}
#endif