Skip to content

Commit 92ea116

Browse files
committed
correctly retry setup packet
1 parent 9c8df30 commit 92ea116

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pio_usb_host.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,12 +615,12 @@ static int __no_inline_not_in_flash_func(usb_setup_transaction)(
615615
pio_usb_bus_wait_handshake(pp);
616616
pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_rx, false);
617617

618-
ep->actual_len = 8;
619-
620618
if (pp->usb_rx_buffer[0] == USB_SYNC && pp->usb_rx_buffer[1] == USB_PID_ACK) {
619+
ep->actual_len = 8;
621620
pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_COMPLETE_BITS);
622621
} else {
623622
res = -1;
623+
ep->data_id = USB_PID_SETUP; // retry setup
624624
if (++ep->failed_count > TRANSACTION_MAX_RETRY) {
625625
pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_ERROR_BITS);
626626
}

0 commit comments

Comments
 (0)