Linux USB
 help / color / mirror / Atom feed
From: kaf@nwlink.com
To: linux-usb@vger.kernel.org
Cc: dave.stevenson@raspberrypi.com
Subject: [GADGET] f_uac2: decoupling bNrChannels from bmChannelConfig?
Date: Tue, 14 Jul 2026 13:04:36 -0700	[thread overview]
Message-ID: <02061d9d4262f4466f2e69a1c5d657da@nwlink.com> (raw)

I've been looking at how f_uac2 determines bNrChannels. The current 
implementation derives the channel count from the population count of 
bmChannelConfig. Since the UAC2 channel location bitmap has only 27 
assignable speaker-position bits (bits 27–30 are reserved, and bit 31 
indicates raw data), this limits the advertised channel count to 27.

While investigating this, I noticed that commercial UAC2 devices (for 
example, the Allen & Heath Qu-5 mixer) advertise bNrChannels=32 while 
leaving bmChannelConfig=0. Linux enumerates that device as a 32-channel 
UAC2 interface.  This also appears to be consistent with the UAC2 
specification.  My use case is generic multichannel data transport 
rather than spatial audio, so a zero bmChannelConfig appears 
semantically appropriate.

To test this approach, I modified f_uac2 to advertise an explicit 
bNrChannels independent of bmChannelConfig, with bmChannelConfig=0. I 
also updated the gadget-side ALSA runtime accordingly.  Linux and macOS 
both enumerated the modified gadget correctly, and end-to-end streaming 
worked successfully via alsaloop.  I repeated the experiment with up to 
96 channels, and both hosts continued to enumerate and stream correctly.

Before investing additional effort, I'd like to understand whether this 
direction is consistent with the intent of the UAC2 gadget 
implementation.  Is the coupling from bmChannelConfig to bNrChannels an 
intentional design decision, or simply a convenient implementation given 
the existing ConfigFS interface?  Are there compatibility concerns that 
motivated coupling bNrChannels to the channel bitmap?

Thanks,
Kyle

                 reply	other threads:[~2026-07-14 20:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02061d9d4262f4466f2e69a1c5d657da@nwlink.com \
    --to=kaf@nwlink.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox