diff --git a/Middlewares/ST/STM32_USB_Device_Library/Class/video/Src/usbd_uvc.c b/Middlewares/ST/STM32_USB_Device_Library/Class/video/Src/usbd_uvc.c index f1278ed..192ca94 100644 --- a/Middlewares/ST/STM32_USB_Device_Library/Class/video/Src/usbd_uvc.c +++ b/Middlewares/ST/STM32_USB_Device_Library/Class/video/Src/usbd_uvc.c @@ -579,8 +579,6 @@ static uint8_t USBD_UVC_EP0_RxReady (USBD_HandleTypeDef *pdev) } hcdc->CmdOpCode = 0xFF; - if (ret == USBD_FAIL) - USBD_CtlError (pdev, 0); } return ret; } diff --git a/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c b/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c index 0158829..a2903f2 100644 --- a/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c +++ b/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c @@ -316,12 +316,16 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev , uint8_t epnum } else { + int ret = USBD_OK; if((pdev->pClass->EP0_RxReady != NULL)&& (pdev->dev_state == USBD_STATE_CONFIGURED)) { - pdev->pClass->EP0_RxReady(pdev); + ret = pdev->pClass->EP0_RxReady(pdev); } - USBD_CtlSendStatus(pdev); + if (ret == USBD_OK) + USBD_CtlSendStatus(pdev); + else if (ret == USBD_FAIL) + USBD_CtlError (pdev, 0); } } } diff --git a/Src/lepton_i2c_task.c b/Src/lepton_i2c_task.c index d9489ed..deb922d 100644 --- a/Src/lepton_i2c_task.c +++ b/Src/lepton_i2c_task.c @@ -570,10 +570,16 @@ PT_THREAD( lepton_attribute_xfer_task(struct pt *pt)) ( LEP_ATTRIBUTE_T_PTR )req.buffer, req.length >> 1, &result)); - - if (result != LEP_OK) - USBD_CtlError(hUsbDevice_0, 0); } + + HAL_NVIC_DisableIRQ(OTG_FS_IRQn); + + if (result == LEP_OK) + USBD_CtlSendStatus(hUsbDevice_0); + else + USBD_CtlError(hUsbDevice_0, 0); + + HAL_NVIC_EnableIRQ(OTG_FS_IRQn); } } diff --git a/Src/usbd_uvc_if.c b/Src/usbd_uvc_if.c index 1aac5f3..653f623 100644 --- a/Src/usbd_uvc_if.c +++ b/Src/usbd_uvc_if.c @@ -413,7 +413,7 @@ static int8_t UVC_VC_ControlSet (VC_TERMINAL_ID entity_id, uint8_t cmd, uint8_t .length = length, .buffer = pbuf, }) == HAL_OK) - return (USBD_OK); + return (USBD_BUSY); else return (USBD_FAIL); #endif