Skip to content

Commit f3fdfe3

Browse files
committed
Fixed error, when host send some buffer, less then minimum, and new buffer can't be allocated
1 parent 7a0baa6 commit f3fdfe3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: cores/arduino/stm32/usb/cdc/usbd_cdc.c

+12
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,18 @@ uint8_t USBD_CDC_ClearBuffer(USBD_HandleTypeDef *pdev)
899899
}
900900
}
901901

902+
uint8_t USBD_CDC_ClearBuffer(USBD_HandleTypeDef *pdev)
903+
{
904+
/* Suspend or Resume USB Out process */
905+
if (pdev->pClassData != NULL) {
906+
/* Prepare Out endpoint to receive next packet */
907+
USBD_LL_PrepareReceive(pdev, CDC_OUT_EP, 0, 0);
908+
return USBD_OK;
909+
} else {
910+
return USBD_FAIL;
911+
}
912+
}
913+
902914
#endif /* USBD_USE_CDC */
903915
#endif /* USBCON */
904916
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
 (0)