From: Alexandre Ratchov Subject: Re: uaudio(4): dynamic feature unit control size for UAC2 To: Jonathan Armani Cc: Andrew Kloet , tech@openbsd.org Date: Mon, 16 Nov 2026 21:49:24 +0100 On Sun, Nov 15, 2026 at 04:24:52PM +0100, Jonathan Armani wrote: > > Hello Andrew, Alex, > > Perfect occupation for a rainy day :) > > From what I read in your USB dump, the feature units are 18 bytes > long, i.e. master + 2 per-channel bitmaps, but their sources have > 8 and 4 channels so we run out of descriptor in the per-channel > loop. > > If I understand it correctly, your diff works by accident : on UAC2 > it reads the low byte of bmaControls(0) as bControlSize, which is 0 > here, so size = 0 and uaudio_getnum() never fails. > > Could you try the diff below instead ? It stops the loop when the > descriptor is exhausted, which also covers the existing "no > per-channel descriptors" special case. > > Also, could you send a raw dump of the descriptor ? I'd expect > 1 byte left at the failure point, not 28. > > --- a/sys/dev/usb/uaudio.c > +++ b/sys/dev/usb/uaudio.c > @@ -1494,13 +1494,13 @@ uaudio_process_unit(struct uaudio_softc > ctl >>= 2; > } > > - /* > - * certain devices provide no per-channel control descriptors > - */ > - if (p.wptr - p.rptr == 1) > - break; > - > for (j = 0; j < u->nch; j++) { > + /* > + * certain devices provide fewer per-channel > + * control descriptors than channels (or none) > + */ > + if (p.wptr - p.rptr < size) > + break; > if (!uaudio_getnum(&p, size, &ctl)) > return 0; > ctl = uaudio_feature_fixup(sc, ctl); > This device has no usb-exposed controls (all FEATURE bitmaps are empty), which makes perfect sense for a mixer with pleny of knobs! So I guess the 2 enties are just "forgotten" by the hardware designers or are there on purpose, ex. to workaround bugs in the driver of a popular operating system I won't name. The above diff may help other devices as well and this is exactly the approach of the driver: be flexible about the uac spec, rather than using kirks. OK ratchov