From 02a1544af7235882328b4b95d5169384b48c0a52 Mon Sep 17 00:00:00 2001 From: Taylor Yu Date: Tue, 22 Nov 2022 13:13:24 -0600 Subject: [PATCH] handle clearing endpoint stall Re-init the endpoint buffer state on ClearFeature(EndpointHalt). --- cores/arduino/USBCore.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index de4452a0..cb9cb397 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -450,6 +450,11 @@ class ClassCore } else if (sent < 0) { return REQ_NOTSUPP; } + } else if ((setup.bmRequestType & USB_RECPTYPE_MASK) == USB_RECPTYPE_EP) { + uint8_t ep = EP_ID(setup.wIndex); + // Reset endpoint state on ClearFeature(EndpointHalt) + EPBuffers().buf(ep).init(ep); + return REQ_SUPP; } else { #ifdef USBD_USE_CDC if (CDCACM().setup(setup))