Download raw body.
uaudio(4): dynamic feature unit control size for UAC2
On Sun Nov 15, 2026 at 10:24 AM EST, 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);
Hi Jonathan,
Thanks for looking at this.
My device is working with your patch.
Here is the raw dump of the descriptor:
00000000: 0902 6201 0501 00c0 fa08 0b00 0301 0020 ..b............
00000010: 0009 0400 0000 0101 2000 0924 0100 020a ........ ..$....
00000020: 6f00 0008 240a 1001 0700 0011 2402 0103 o...$.......$...
00000030: 0600 1008 0000 0000 0400 0000 1224 0602 .............$..
00000040: 0100 0000 0000 0000 0000 0000 0000 0c24 ...............$
00000050: 0303 0101 0002 1000 0000 1124 0204 0101 ...........$....
00000060: 0010 0400 0000 000c 0000 0012 2406 0504 ............$...
00000070: 0000 0000 0000 0000 0000 0000 000c 2403 ..............$.
00000080: 0603 0600 0510 0000 0009 0401 0000 0102 ................
00000090: 2000 0904 0101 0101 0220 0010 2401 0300 ........ ..$...
000000a0: 0101 0000 0008 0000 0000 0406 2402 0104 ............$...
000000b0: 2007 0582 25e0 0001 0825 0100 0000 0000 ...%....%......
000000c0: 0904 0200 0001 0220 0009 0402 0102 0102 ....... ........
000000d0: 2000 1024 0104 0001 0100 0000 0400 0000 ..$............
000000e0: 000c 0624 0201 0420 0705 0205 7000 0108 ...$... ....p...
000000f0: 2501 0000 0000 0007 0581 1104 0004 080b %...............
00000100: 0302 0100 0000 0904 0300 0001 0100 0009 ................
00000110: 2401 0001 0900 0104 0904 0400 0201 0300 $...............
00000120: 0007 2401 0001 4100 0624 0201 0100 0624 ..$...A..$.....$
00000130: 0202 0200 0924 0301 0301 0201 0009 2403 .....$........$.
00000140: 0204 0101 0100 0905 0302 0002 0000 0005 ................
00000150: 2501 0101 0905 8302 0002 0700 0005 2501 %.............%.
00000160: 0103 ..
--
Andrew
uaudio(4): dynamic feature unit control size for UAC2