Skip to content

Commit e49dc6b

Browse files
committed
host: failed if try to re-open an opened endpoint
1 parent 0ca3657 commit e49dc6b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/pio_usb_host.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ static inline __force_inline endpoint_t * _find_ep(uint8_t root_idx,
424424
bool pio_usb_host_endpoint_open(uint8_t root_idx, uint8_t device_address,
425425
uint8_t const *desc_endpoint, bool need_pre) {
426426
const endpoint_descriptor_t *d = (const endpoint_descriptor_t *)desc_endpoint;
427+
if (NULL != _find_ep(root_idx, device_address, d->epaddr)) {
428+
return false; // endpoint already opened
429+
}
427430
for (int ep_pool_idx = 0; ep_pool_idx < PIO_USB_EP_POOL_CNT; ep_pool_idx++) {
428431
endpoint_t *ep = PIO_USB_ENDPOINT(ep_pool_idx);
429432
// ep size is used as valid indicator

0 commit comments

Comments
 (0)