snd_uaudio 2.0 class support for 24-bit samples with bSubslotSize=4

Ed Maste emaste at freebsd.org
Wed Apr 24 01:20:35 UTC 2013


I have a Focusrite Scarlett 2i2 USB recording interface.  It's a USB
audio 2.0 class device but unfortunately doesn't work with snd_uaudio.
 As it turns out, it's a 24-bit device (as reported in bBitResolution)
but uses 4 bytes per sample (bSubslotSize) and thus falls to the
"Invalid bSubslotSize" case in uaudio_chan_fill_info_sub().  I'm not
sure how common this is, but it is allowed by the spec.

With the hackish patch below the device works well for playback (I
haven't tested recording), with the side effect of falsely claiming to
be a 32-bit device in dmesg and elsewhere.

Index: uaudio.c
===================================================================
--- uaudio.c    (revision 249781)
+++ uaudio.c    (working copy)
@@ -1413,9 +1414,12 @@
                        bChannels = asid.v2->bNrChannels;
                        bBitResolution = asf1d.v2->bBitResolution;
                        bSubslotSize = asf1d.v2->bSubslotSize;
+                        if (bBitResolution == 24 && bSubslotSize == 4)
+                               bBitResolution = 32;

                        if (bBitResolution != (bSubslotSize * 8)) {


More information about the freebsd-usb mailing list