Commit d22111c
Vyacheslav Furyst
fix(usbh_cdc/ecm): fix data pipe stalls for CDC-ECM on SW reboot and alt-setting switch
Three related fixes for CDC-ECM bulk data pipe reliability:
1. in_xfer_cb: handle CANCELED separately — resubmit the IN transfer so
the receive chain restarts automatically after SET_INTERFACE flushes
the endpoint during alt=0→alt=1 switch. Remove the retry logic from
the default (error) case: leave the pipe HALTED so the USB host
client's USBH_EP_CMD_FLUSH can run without hitting
ESP_ERR_INVALID_STATE.
2. Add usbh_cdc_restart_in_transfer(): called by the ECM layer after
SET_INTERFACE(alt=1) completes to clear the HALTED IN pipe and
resubmit the IN transfer chain.
3. Add usbh_cdc_restart_out_transfer(): on a software reboot the device
is not power-cycled, so the OUT pipe may be left HALTED from the
previous session. Clears the halt and releases the semaphore, guarded
by a semaphore-count check so it is a no-op on a healthy pipe (safe
to call on both HW and SW reboots).
4. Set USB_TRANSFER_FLAG_ZERO_PACK on the bulk OUT transfer so a ZLP is
sent when payload size is an exact multiple of the 64-byte MPS, as
required by CDC-ECM spec §3.3.1.
Both restart functions are called from iot_usbh_ecm after
SET_INTERFACE(alt=1) completes.
Tested on ESP32-S3 with a USB modem (VID:1F94 PID:3002),verified on both
hardware power-cycle and software reboot (esp_restart()).1 parent ab9021a commit d22111c
3 files changed
Lines changed: 116 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
384 | 412 | | |
385 | 413 | | |
386 | 414 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
573 | | - | |
574 | 573 | | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
580 | 583 | | |
581 | 584 | | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
582 | 603 | | |
583 | 604 | | |
584 | 605 | | |
| |||
608 | 629 | | |
609 | 630 | | |
610 | 631 | | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
611 | 675 | | |
612 | 676 | | |
613 | 677 | | |
| |||
706 | 770 | | |
707 | 771 | | |
708 | 772 | | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
709 | 778 | | |
710 | 779 | | |
711 | 780 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
268 | 281 | | |
269 | 282 | | |
270 | 283 | | |
| |||
0 commit comments