From e47c4f2c41a774632800030192394a471a798507 Mon Sep 17 00:00:00 2001 From: rlam23 <137520495+rlam23@users.noreply.github.com> Date: Fri, 23 Jun 2023 07:35:52 -0700 Subject: [PATCH] Endpoint 0 is stalled if an invalid descriptor type is specified in a standard USB get descriptor request to the HID interface. --- .../Class/CustomHID/Src/usbd_customhid.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src/usbd_customhid.c b/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src/usbd_customhid.c index 8998070c..ece30437 100644 --- a/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src/usbd_customhid.c +++ b/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src/usbd_customhid.c @@ -500,7 +500,15 @@ static uint8_t USBD_CUSTOM_HID_Setup(USBD_HandleTypeDef *pdev, } } - USBD_CtlSendData(pdev, pbuf, len); + if (pbuf) + { + USBD_CtlSendData(pdev, pbuf, len); + } + else + { + USBD_CtlError(pdev, req); + ret = USBD_FAIL; + } break; case USB_REQ_GET_INTERFACE :