/*
LUFA Library
- Copyright (C) Dean Camera, 2015.
+ Copyright (C) Dean Camera, 2018.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 2015 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 2018 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
#define MemoryAddressSpace MEMSPACE_FLASH
#elif defined(USE_EEPROM_DESCRIPTORS)
#define MemoryAddressSpace MEMSPACE_EEPROM
- #elif defined(USE_SRAM_DESCRIPTORS)
- #define MemoryAddressSpace MEMSPACE_SRAM
+ #elif defined(USE_RAM_DESCRIPTORS)
+ #define MemoryAddressSpace MEMSPACE_RAM
#else
uint8_t MemoryAddressSpace;
#endif
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;
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();
#endif
break;
+ }
default:
return;
}
{
#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);
}
break;
+ }
#endif
default:
return;