Skip to content

usbhost: poll a full-speed audio stream's isochronous endpoint every frame - #166

Merged
bdbarnett merged 1 commit into
mainfrom
fix/usbhost-fs-iso-interval
Oct 22, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
fix/usbhost-fs-iso-interval

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

A webcam's microphone behind the DEV-KIT's hub arrived at one packet in eight once the USB host had run at full speed (workspace#16). Its configuration is the same at both speeds and says bInterval 4 on the audio endpoint: eight microframes (1 ms) at high speed, but eight frames (8 ms) at full speed. ESP-IDF's host driver polls what the descriptor says (hcd_dwc.c takes 1 << (bInterval - 1) frames for a full-speed isochronous pipe), so a 16 kHz stereo mic gave 125 packets a second instead of 1000.

USB Audio gives a full-speed streaming endpoint a period of one frame, and Linux's audio driver ignores the field at full speed for the same reason. usbhost_xfer_claim() now sets it to 1 in the library's copy of the configuration descriptor, just before usb_host_interface_claim() reads it, and only for an isochronous endpoint of an AudioStreaming interface on a full-speed device. Video endpoints, high speed and everything else are untouched. The walker is in shared/usbhost_audio_interval.h, free of IDF, with a host-side test and a planted fault in the workflow.

On the DEV-KIT (C920e mic, reset, Instruments then Wake word, mic.stats() over 5 s): 125 packets/s and 8174 B/s before, 1000 packets/s and 64000 B/s after, with no errors or empty packets, and inject_clip.py still gets "Hey Jarvis".

…frame

A webcam microphone has one configuration for both speeds and says
bInterval 4: 1 ms at high speed, 8 ms at full speed. IDF polls what the
descriptor says, so with the host held to full speed behind the DEV-KIT's hub
a 16 kHz stereo mic delivered 126 packets a second instead of 999. USB Audio
puts a full-speed streaming endpoint at one frame; set the field to 1 in IDF's
copy of the descriptor before the interface is claimed, for AudioStreaming
interfaces at full speed only. Host-side test with a planted fault, in CI.
@bdbarnett
bdbarnett merged commit 8adcfef into main Oct 22, 2026
6 checks passed
@bdbarnett
bdbarnett deleted the fix/usbhost-fs-iso-interval branch October 22, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant