wch/usbfs host: default endpoint table leaves a hubless device 3 data endpoints (was 4)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 64/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c
- Domain
- embedded-iot
Research direction
Start at src/portable/wch/usbfs/hcd_wch_usbfs.c: the macro around lines 55-57 sizes the endpoint table, while lines 148-149 reserve ep[0] for address 0 and give the addressed EP0 its own record. Read how hcd_edpt_open() (around line 762) indexes that table, then compare with the old hcd_ch32_usbfs.c usb_edpt_list[CFG_TUH_DEVICE_MAX*6], which left four data endpoints. Done means the default hubless config admits EP0 plus four data endpoints, or the reduced default is documented.
Written by the indexing model from the issue text.
Description
With the default config (CFG_TUH_DEVICE_MAX 1, CFG_TUH_HUB 0), CFG_TUH_WCH_USBFS_ENDPOINT_MAX is 5 (https://github.com/hathach/tinyusb/blob/490eb4ec9/src/portable/wch/usbfs/hcd_wch_usbfs.c#L55-L57). ep[0] is reserved for address 0 and the addressed EP0 takes one record (:148-149), so one hubless device gets 3 data endpoints and hcd_edpt_open() fails on the 4th (:762). The old hcd_ch32_usbfs.c (usb_edpt_list[CFG_TUH_DEVICE_MAX*6], 53c1d1473) left 4.
Found syncing 490eb4ec9 into adafruit/Adafruit_TinyUSB_Arduino#642 (review comment by CodeRabbit), verified in source.
Trigger: default config, no hub, a device with 4 data endpoints (e.g. CDC-ACM with 3 plus a HID IN): the last interface's endpoint fails to open. Overriding the macro works around it.
Introduced by: a76e22cbc ("endpoint table sized by device count").
Remaining work: size per device as 1 (EP0) + 4 data endpoints, matching the comment "control plus about three endpoints" and the old driver's capacity, or document the reduced default.
Why deferred: found on the downstream sync PR, which carries upstream bytes only. Not reproduced on hardware.
- Dominant language
- C
- Stars
- 7.3k
- Forks
- 1.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 67
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
-
follow-up Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
hil-contract: a background hil_remote.py launch is killed at the Bash default 10 min timeoutPossibly taken @hathach claimed this 16 days ago. Openfollow-up Prio 📌
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
ch32v30x: debug UART loses queued bytes when its TX ring fillsPossibly taken @hathach claimed this 16 days ago. Openfollow-up Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 66/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 69/100
-
Missing slice offset check in jvp_equal fast path corrupts slice comparison and aborts delpathsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
area9innovation/flow9#1805 ·
Maintainers usually reply within 3 days
-
AI:Robustness triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
open5gs/open5gs#5246 · 1 comment ·
Maintainers usually reply within 1 day