wch/usbfs host: full-speed isochronous bInterval 9-16 rejected

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
58/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
embedded-iot

Research direction

Start at hcd_edpt_open() in src/portable/wch/usbfs/hcd_wch_usbfs.c around lines 736-740, where the full-speed isochronous bInterval range is checked, and compare with tu_edpt_validate() to see why the gap exists. Read USB 2.0 §9.6.6 and p75 on poll rates, then look at how the resulting period feeds the frame/deadline arithmetic in the same file. Done means bInterval 9..16 is accepted with the period clamped to 128 frames; since the report was not reproduced on hardware, check what tests or HCD-level harnesses exist before claiming the fix verified, and cross-reference #4522.

Written by the indexing model from the issue text.

Description

follow-up Port WCH USBFS Prio 📌

hcd_edpt_open() rejects a full-speed isochronous endpoint unless bInterval is 1..8 (https://github.com/hathach/tinyusb/blob/490eb4ec9/src/portable/wch/usbfs/hcd_wch_usbfs.c#L736-L740). USB 2.0 §9.6.6 allows 1..16 for full-/high-speed isochronous endpoints, and tu_edpt_validate() does not check it, so a compliant device with bInterval 9..16 fails to open.

Found syncing 490eb4ec9 into adafruit/Adafruit_TinyUSB_Arduino#642 (review comment by CodeRabbit), verified against the spec.

Introduced by: the WCH USBFS host isochronous support (4a397cb94 / a76e22cbc); not present at 53c1d1473.

Remaining work: accept 9..16 and clamp the period to 128 frames. USB 2.0 p75: an isochronous endpoint "must be prepared to handle poll rates faster than the one specified", so polling more often is legal and avoids widening the deadline arithmetic.

Why deferred: found on the downstream sync PR, which carries upstream bytes only. Not reproduced on hardware.

Related: #4522 — other bInterval validation.

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

  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.