HID class: handle host restart gracefully

USG_1.0
Robert Fisk 9 years ago
parent 6d52d3b8fc
commit 5d393a0100

@ -298,7 +298,6 @@ static uint8_t USBD_HID_Init (USBD_HandleTypeDef *pdev,
static uint8_t USBD_HID_DeInit (USBD_HandleTypeDef *pdev,
uint8_t cfgidx)
{
ActiveReportDescriptor = NULL;
Upstream_HID_DeInit();
/* Close HID EPs */

@ -55,6 +55,13 @@ HAL_StatusTypeDef Upstream_HID_GetNextReport(UpstreamHidSendReportCallback callb
return HAL_ERROR;
}
//Just return if we already have an outstanding request
if (ReportCallback != NULL)
{
return HAL_OK;
}
ReportCallback = callback;
//Release packet used for last transaction (if any)
if (UpstreamHidPacket != NULL)
{
@ -62,8 +69,6 @@ HAL_StatusTypeDef Upstream_HID_GetNextReport(UpstreamHidSendReportCallback callb
UpstreamHidPacket = NULL;
}
ReportCallback = callback;
freePacket = Upstream_GetFreePacketImmediately();
if (freePacket == NULL)
{

Loading…
Cancel
Save