Skip to content
Snippets Groups Projects
Commit 2bd88ebc authored by Dean Camera's avatar Dean Camera
Browse files

Minor correction to the DevChapter9.c handling of Set and Clear feature...

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.
parent a908773a
Branches
Tags
No related merge requests found
...@@ -274,6 +274,8 @@ static void USB_Device_ClearSetFeature(void) ...@@ -274,6 +274,8 @@ static void USB_Device_ClearSetFeature(void)
case REQREC_DEVICE: 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
return;
break; break;
#if !defined(CONTROL_ONLY_DEVICE) #if !defined(CONTROL_ONLY_DEVICE)
...@@ -282,8 +284,9 @@ static void USB_Device_ClearSetFeature(void) ...@@ -282,8 +284,9 @@ static void USB_Device_ClearSetFeature(void)
{ {
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
if (EndpointIndex != ENDPOINT_CONTROLEP) if (EndpointIndex == ENDPOINT_CONTROLEP)
{ return;
Endpoint_SelectEndpoint(EndpointIndex); Endpoint_SelectEndpoint(EndpointIndex);
if (Endpoint_IsEnabled()) if (Endpoint_IsEnabled())
...@@ -299,16 +302,20 @@ static void USB_Device_ClearSetFeature(void) ...@@ -299,16 +302,20 @@ static void USB_Device_ClearSetFeature(void)
Endpoint_StallTransaction(); Endpoint_StallTransaction();
} }
} }
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
Endpoint_ClearSETUP();
Endpoint_ClearIN();
}
} }
break; break;
#endif #endif
} }
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
Endpoint_ClearSETUP();
Endpoint_ClearIN();
while (!(Endpoint_IsOUTReceived()));
Endpoint_ClearOUT();
} }
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment