Skip to content

Commit ace22e0

Browse files
committed
correct number of retry attempt
1 parent 92ea116 commit ace22e0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pio_usb_host.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ static int __no_inline_not_in_flash_func(usb_in_transaction)(pio_port_t *pp,
540540
res = -2;
541541
}
542542

543-
if (++ep->failed_count > TRANSACTION_MAX_RETRY) {
543+
if (++ep->failed_count >= TRANSACTION_MAX_RETRY) {
544544
pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_ERROR_BITS); // failed after 3 consecutive retries
545545
}
546546
}
@@ -581,7 +581,7 @@ static int __no_inline_not_in_flash_func(usb_out_transaction)(pio_port_t *pp,
581581
pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_STALLED_BITS);
582582
} else {
583583
res = -1;
584-
if (++ep->failed_count > TRANSACTION_MAX_RETRY) {
584+
if (++ep->failed_count >= TRANSACTION_MAX_RETRY) {
585585
pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_ERROR_BITS);
586586
}
587587
}
@@ -621,7 +621,7 @@ static int __no_inline_not_in_flash_func(usb_setup_transaction)(
621621
} else {
622622
res = -1;
623623
ep->data_id = USB_PID_SETUP; // retry setup
624-
if (++ep->failed_count > TRANSACTION_MAX_RETRY) {
624+
if (++ep->failed_count >= TRANSACTION_MAX_RETRY) {
625625
pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_ERROR_BITS);
626626
}
627627
}

0 commit comments

Comments
 (0)