Update test to restart reads after unstall

After an endpoint is unstalled any pending transfers are terminated.
This patch re-starts any reads that were ongoing.
pull/9768/head
Russ Butler 2018-06-21 11:27:56 -05:00
parent 27bd1656b1
commit 7563a0f03f
1 changed files with 23 additions and 0 deletions

View File

@ -228,6 +228,29 @@ void USBEndpointTester::callback_request(const setup_packet_t *setup)
result = PassThrough;
break;
}
} else if ((setup->bmRequestType.Type == STANDARD_TYPE) && (setup->bmRequestType.Recipient == ENDPOINT_RECIPIENT)) {
if (setup->bRequest == CLEAR_FEATURE) {
usb_ep_t ep = setup->wIndex;
bool valid = false;
uint32_t ep_index = 0;
if (ep == _endpoints[EP_BULK_OUT]) {
valid = true;
ep_index = EP_BULK_OUT;
} else if (ep == _endpoints[EP_INT_OUT]) {
valid = true;
ep_index = EP_INT_OUT;
} else if (ep == _endpoints[EP_ISO_OUT]) {
valid = true;
ep_index = EP_ISO_OUT;
}
if (valid) {
// Restart reads when an OUT endpoint is unstalled
result = Success;
endpoint_unstall(ep);
read_start(_endpoints[ep_index], _endpoint_buffs[ep_index], (*_endpoint_configs)[ep_index].max_packet);
}
}
}
complete_request(result, data, size);
}