diff --git a/firmware/Core/Src/main.c b/firmware/Core/Src/main.c index 1309e92..dabb999 100644 --- a/firmware/Core/Src/main.c +++ b/firmware/Core/Src/main.c @@ -874,19 +874,27 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ } case VENDOR_REQUEST_WEBUSB: { - return tud_control_status(rhport, request); + if (stage == CONTROL_STAGE_SETUP) { + return tud_control_status(rhport, request); + } + + return true; } case VENDOR_REQUEST_MICROSOFT: { - if (request->wIndex == 7) { - // Get Microsoft OS 2.0 compatible descriptor - uint16_t total_len; - memcpy(&total_len, desc_ms_os_20 + 8, 2); + if (stage == CONTROL_STAGE_SETUP) { + if (request->wIndex == 7) { + // Get Microsoft OS 2.0 compatible descriptor + uint16_t total_len; + memcpy(&total_len, desc_ms_os_20 + 8, 2); + + return tud_control_xfer(rhport, request, (void *)(uintptr_t)desc_ms_os_20, total_len); + } - return tud_control_xfer(rhport, request, (void *)(uintptr_t)desc_ms_os_20, total_len); - } else { return false; } + + return false; } default: @@ -894,9 +902,23 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ } } - default: + case TUSB_REQ_TYPE_CLASS: { + if (stage == CONTROL_STAGE_SETUP) { + if (request->bRequest == 0x22) { + // response with status OK + return tud_control_status(rhport, request); + } + + return false; + } + + return true; + } + + default: { break; } + } return false; }