diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2016-04-03 11:34:34 +1000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2016-04-03 11:34:34 +1000 |
commit | 9cca7a594f23f46d56ded6ab806235e3fc62055d (patch) | |
tree | 5204ce2d3c0f53112430a411b34f85cb670bee1c /LUFA/Drivers/USB/Core/DeviceStandardReq.c | |
parent | 9864c02eb4a33b260cc016b7108a12412b9264b5 (diff) | |
parent | 9669a00c34dc7545b2ca538b5aa0fde745483824 (diff) | |
download | lufa-9cca7a594f23f46d56ded6ab806235e3fc62055d.tar.gz lufa-9cca7a594f23f46d56ded6ab806235e3fc62055d.tar.bz2 lufa-9cca7a594f23f46d56ded6ab806235e3fc62055d.zip |
Merge branch 'master' into dmbs
Diffstat (limited to 'LUFA/Drivers/USB/Core/DeviceStandardReq.c')
-rw-r--r-- | LUFA/Drivers/USB/Core/DeviceStandardReq.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/LUFA/Drivers/USB/Core/DeviceStandardReq.c b/LUFA/Drivers/USB/Core/DeviceStandardReq.c index 831581569..e296d8d59 100644 --- a/LUFA/Drivers/USB/Core/DeviceStandardReq.c +++ b/LUFA/Drivers/USB/Core/DeviceStandardReq.c @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2015. + Copyright (C) Dean Camera, 2016. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2016 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted @@ -292,6 +292,7 @@ static void USB_Device_GetStatus(void) switch (USB_ControlRequest.bmRequestType) { case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE): + { #if !defined(NO_DEVICE_SELF_POWER) if (USB_Device_CurrentlySelfPowered) CurrentStatus |= FEATURE_SELFPOWERED_ENABLED; @@ -302,9 +303,16 @@ static void USB_Device_GetStatus(void) CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED; #endif break; + } case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT): + { #if !defined(CONTROL_ONLY_DEVICE) - Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); + uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); + + if (EndpointIndex >= ENDPOINT_TOTAL_ENDPOINTS) + return; + + Endpoint_SelectEndpoint(EndpointIndex); CurrentStatus = Endpoint_IsStalled(); @@ -312,6 +320,7 @@ static void USB_Device_GetStatus(void) #endif break; + } default: return; } @@ -330,20 +339,23 @@ static void USB_Device_ClearSetFeature(void) { #if !defined(NO_DEVICE_REMOTE_WAKEUP) case REQREC_DEVICE: + { if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup) USB_Device_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature); else return; break; + } #endif #if !defined(CONTROL_ONLY_DEVICE) case REQREC_ENDPOINT: + { if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt) { uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); - if (EndpointIndex == ENDPOINT_CONTROLEP) + if (EndpointIndex == ENDPOINT_CONTROLEP || EndpointIndex >= ENDPOINT_TOTAL_ENDPOINTS) return; Endpoint_SelectEndpoint(EndpointIndex); @@ -364,6 +376,7 @@ static void USB_Device_ClearSetFeature(void) } break; + } #endif default: return; |