aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Drivers')
-rw-r--r--LUFA/Drivers/USB/LowLevel/DevChapter9.c28
-rw-r--r--LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c2
2 files changed, 15 insertions, 15 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.c b/LUFA/Drivers/USB/LowLevel/DevChapter9.c
index 7d9e81502..17a5fd471 100644
--- a/LUFA/Drivers/USB/LowLevel/DevChapter9.c
+++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.c
@@ -323,7 +323,7 @@ static void USB_Device_GetStatus(void)
#endif
#if !defined(CONTROL_ONLY_DEVICE)
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
- Endpoint_SelectEndpoint(USB_ControlRequest.wIndex & 0xFF);
+ Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
CurrentStatus = Endpoint_IsStalled();
@@ -344,7 +344,7 @@ static void USB_Device_GetStatus(void)
}
static void USB_Device_ClearSetFeature(void)
-{
+{
switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)
{
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
@@ -367,18 +367,18 @@ static void USB_Device_ClearSetFeature(void)
Endpoint_SelectEndpoint(EndpointIndex);
- if (Endpoint_IsEnabled())
- {
- if (USB_ControlRequest.bRequest == REQ_SetFeature)
- {
- Endpoint_StallTransaction();
- }
- else
- {
- Endpoint_ClearStall();
- Endpoint_ResetFIFO(EndpointIndex);
- Endpoint_ResetDataToggle();
- }
+ if (!(Endpoint_IsEnabled()))
+ return;
+
+ if (USB_ControlRequest.bRequest == REQ_SetFeature)
+ {
+ Endpoint_StallTransaction();
+ }
+ else
+ {
+ Endpoint_ClearStall();
+ Endpoint_ResetFIFO(EndpointIndex);
+ Endpoint_ResetDataToggle();
}
}
diff --git a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c
index 70560cf46..7868060fe 100644
--- a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c
+++ b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c
@@ -21,7 +21,7 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length)
if (Endpoint_IsINReady())
{
- uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();
+ uint8_t BytesInEndpoint = Endpoint_BytesInEndpoint();
while (Length && (BytesInEndpoint < USB_ControlEndpointSize))
{