HID class: handle host restart gracefully

pull/7/head
Robert Fisk 9 years ago
parent 671f4d6265
commit fa98307a3b

@ -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