diff --git a/embed/trezorhal/usbd_core.c b/embed/trezorhal/usbd_core.c index 876d6122a3..265cf86cc0 100644 --- a/embed/trezorhal/usbd_core.c +++ b/embed/trezorhal/usbd_core.c @@ -289,7 +289,6 @@ USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup) break; case USB_REQ_TYPE_CLASS: - case USB_REQ_TYPE_VENDOR: if (pdev->dev_state == USBD_STATE_CONFIGURED) { if (pdev->pClass->Setup != NULL) pdev->pClass->Setup(pdev, &pdev->request); @@ -297,6 +296,15 @@ USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup) USBD_CtlError(pdev, &pdev->request); } break; + + case USB_REQ_TYPE_VENDOR: + if (pdev->dev_state == USBD_STATE_CONFIGURED || pdev->dev_state == USBD_STATE_ADDRESSED) { + if (pdev->pClass->Setup != NULL) + pdev->pClass->Setup(pdev, &pdev->request); + } else { + USBD_CtlError(pdev, &pdev->request); + } + break; } return USBD_OK;