|
|
@ -307,18 +307,19 @@ static void USB_Device_GetStatus(void)
|
|
|
|
|
|
|
|
|
|
|
|
switch (USB_ControlRequest.bmRequestType)
|
|
|
|
switch (USB_ControlRequest.bmRequestType)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
#if !defined(NO_DEVICE_SELF_POWER) || !defined(NO_DEVICE_REMOTE_WAKEUP)
|
|
|
|
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE):
|
|
|
|
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE):
|
|
|
|
#if !defined(NO_DEVICE_SELF_POWER)
|
|
|
|
#if !defined(NO_DEVICE_SELF_POWER)
|
|
|
|
if (USB_CurrentlySelfPowered)
|
|
|
|
if (USB_CurrentlySelfPowered)
|
|
|
|
CurrentStatus |= FEATURE_SELFPOWERED_ENABLED;
|
|
|
|
CurrentStatus |= FEATURE_SELFPOWERED_ENABLED;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
|
|
|
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
|
|
|
if (USB_RemoteWakeupEnabled)
|
|
|
|
if (USB_RemoteWakeupEnabled)
|
|
|
|
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
|
|
|
|
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#if !defined(CONTROL_ONLY_DEVICE)
|
|
|
|
#if !defined(CONTROL_ONLY_DEVICE)
|
|
|
|
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
|
|
|
|
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
|
|
|
|
Endpoint_SelectEndpoint(USB_ControlRequest.wIndex & 0xFF);
|
|
|
|
Endpoint_SelectEndpoint(USB_ControlRequest.wIndex & 0xFF);
|
|
|
@ -345,15 +346,15 @@ static void USB_Device_ClearSetFeature(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)
|
|
|
|
switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case REQREC_DEVICE:
|
|
|
|
|
|
|
|
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
|
|
|
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
|
|
|
|
|
|
|
|
case REQREC_DEVICE:
|
|
|
|
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_REMOTE_WAKEUP)
|
|
|
|
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_REMOTE_WAKEUP)
|
|
|
|
USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
|
|
|
|
USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#if !defined(CONTROL_ONLY_DEVICE)
|
|
|
|
#if !defined(CONTROL_ONLY_DEVICE)
|
|
|
|
case REQREC_ENDPOINT:
|
|
|
|
case REQREC_ENDPOINT:
|
|
|
|
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_ENDPOINT_HALT)
|
|
|
|
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_ENDPOINT_HALT)
|
|
|
@ -382,6 +383,8 @@ static void USB_Device_ClearSetFeature(void)
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
|
|
|
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
|
|
|