rp2040/hcd: validate EPX abort when a device is unplugged mid-transfer
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c, raspberry-pi
- Domain
- embedded-iot, testing-qa
Research direction
Start with src/portable/rp2040/hcd_rp2040.c at epx_retire and sie_stop_xfer to understand the abort path. On pico2 and pico_w, reproduce MSC reads while unplugging behind the hub and from the root port about 20 times each, using Port Authority on ci.lan or uhubctl locally. Done means no panic or hang, and the device enumerates again after replugging.
Written by the indexing model from the issue text.
Description
From #4166. The new EPX abort and retire path (epx_retire, https://github.com/hathach/tinyusb/blob/e20482387/src/portable/raspberrypi/rp2040/hcd_rp2040.c#L222) was tested only on a device that stays attached and doesn't respond. The tests forced faults with gdb: a STALL, an RX timeout to an unused address, and NAKs until the watchdog fired. A physical unplug that lands in the middle of a transfer was not tested:
- the device is unplugged behind the hub while a transfer is ACTIVE on EPX, then the hub reports it and usbh runs
hcd_device_close; - the device is unplugged from the root port while EPX is ACTIVE (
HOST_CONN_DIS).
epx_retire busy-waits on the self-clearing STOP_TRANS bit (sie_stop_xfer). In every test it cleared at once, but nothing has shown what it does once the bus is gone.
Remaining work
- On pico2 and pico_w, unplug the device behind the hub and on the root port during an MSC read, about 20 times each. Use a Port Authority port cycle on ci.lan, or uhubctl locally.
- Pass criteria: no panic, no hang in
sie_stop_xfer, and the device enumerates again when replugged.
Why deferred: this needs repeated unplugs to catch a transfer in flight. It doesn't block the #4108 fix, which was proven by fault injection.
- Dominant language
- C
- Stars
- 7.2k
- Forks
- 1.6k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 96
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hathach/tinyusb
-
followup Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
followup Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
test_audio_host: out-of-bounds read in test_audio_host_uses_exponential_full_speed_iso_intervalOpenfollowup Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
followup Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
followup Prio 📌
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
polhenarejos/pico-fido#302 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
espressif/esp-vision#16 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
libsdl-org/SDL#16577 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
halt_error adds a trailing newline for non-string input, contrary to the manualPossibly taken @Huang-404-Q claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days