Merge pull request #1184 from martinling/flush-on-setup

Flush queues on control endpoint when a new SETUP is received.
This commit is contained in:
Michael Ossmann
2022-09-27 13:19:27 -04:00
committed by GitHub

View File

@ -60,6 +60,11 @@ static void usb_request(usb_endpoint_t* const endpoint, const usb_transfer_stage
void usb_setup_complete(usb_endpoint_t* const endpoint)
{
// If we've received a new SETUP token, then any previously
// in-progress request is now aborted.
usb_endpoint_flush(endpoint->in);
usb_endpoint_flush(endpoint->out);
usb_request(endpoint, USB_TRANSFER_STAGE_SETUP);
}