aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-05-06 13:17:38 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-05-06 13:17:38 +0000
commit2bd88ebc4f37baf81d550e79b3e3118b0843e61c (patch)
tree911b3d369976d5682e8da85008e030da4a5539e0
parenta908773a13ee491f2f8907cdf57c26fb39e10658 (diff)
downloadlufa-2bd88ebc4f37baf81d550e79b3e3118b0843e61c.tar.gz
lufa-2bd88ebc4f37baf81d550e79b3e3118b0843e61c.tar.bz2
lufa-2bd88ebc4f37baf81d550e79b3e3118b0843e61c.zip
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.
-rw-r--r--LUFA/Drivers/USB/LowLevel/DevChapter9.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.c b/LUFA/Drivers/USB/LowLevel/DevChapter9.c
index 9c319fc07..f02d32ba3 100644
--- a/LUFA/Drivers/USB/LowLevel/DevChapter9.c
+++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.c
@@ -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 (Endpoint_IsEnabled())
- {
- if (USB_ControlRequest.bRequest == REQ_ClearFeature)
- {
- Endpoint_ClearStall();
- Endpoint_ResetFIFO(EndpointIndex);
- Endpoint_ResetDataToggle();
- }
- else
- {
- Endpoint_StallTransaction();
- }
+ if (EndpointIndex == ENDPOINT_CONTROLEP)
+ return;
+
+ 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