Skip to content

Commit 1ecb873

Browse files
committed
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.
1 parent 712fb1c commit 1ecb873

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

TESTS/usb_device/basic/USBEndpointTester.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,29 @@ void USBEndpointTester::callback_request(const setup_packet_t *setup)
228228
result = PassThrough;
229229
break;
230230
}
231+
} else if ((setup->bmRequestType.Type == STANDARD_TYPE) && (setup->bmRequestType.Recipient == ENDPOINT_RECIPIENT)) {
232+
if (setup->bRequest == CLEAR_FEATURE) {
233+
usb_ep_t ep = setup->wIndex;
234+
bool valid = false;
235+
uint32_t ep_index = 0;
236+
if (ep == _endpoints[EP_BULK_OUT]) {
237+
valid = true;
238+
ep_index = EP_BULK_OUT;
239+
} else if (ep == _endpoints[EP_INT_OUT]) {
240+
valid = true;
241+
ep_index = EP_INT_OUT;
242+
} else if (ep == _endpoints[EP_ISO_OUT]) {
243+
valid = true;
244+
ep_index = EP_ISO_OUT;
245+
}
246+
247+
if (valid) {
248+
// Restart reads when an OUT endpoint is unstalled
249+
result = Success;
250+
endpoint_unstall(ep);
251+
read_start(_endpoints[ep_index], _endpoint_buffs[ep_index], (*_endpoint_configs)[ep_index].max_packet);
252+
}
253+
}
231254
}
232255
complete_request(result, data, size);
233256
}

0 commit comments

Comments
 (0)