Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

rp2040/hcd: validate EPX abort when a device is unplugged mid-transfer

Open
#4,169 0 comments 0 reactions 0 assignees View on GitHub

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

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

followup Prio 📌

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hathach/tinyusb

All issues in hathach/tinyusb

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.