All of lore.kernel.org
 help / color / mirror / Atom feed
From: RenPanpan <rppxj178543@163.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [DISCUSSION] ALSA: usb-audio: Card naming for composite devices
Date: Fri, 30 Oct 2026 09:34:52 +0800 (CST)	[thread overview]
Message-ID: <6AE3F43C.0F8E64.00008@m16.mail.163.com> (raw)

Hello,

I'd like to discuss an issue with USB audio card naming for composite
devices and propose a possible improvement.

Problem
-------

For USB composite devices containing both non-audio and UAC audio
functions, the ALSA card shortname is derived from the device-level
iProduct string, which describes the entire device rather than the
audio function.

For example, the CVT Touch Device (1ff7:0f33) is a composite device
with HID touch interfaces and UAC audio interfaces. Its iProduct is
"Touch Device", which is the name for the whole device. The UAC
OUTPUT_TERMINAL descriptor defines the audio function name as
"MAXHUB Speaker" via the iTerminal string descriptor (index 14).

Currently, the ALSA card name shows "Touch Device", which does not
identify the audio function. The UAC mixer code already reads
iTerminal for mixer control names (e.g. "MAXHUB Mic" from the
Microphone INPUT_TERMINAL's iTerminal=17), but the card naming
function (usb_audio_make_shortname) does not use iTerminal.

Proposed approach
-----------------

When the USB device is composite (i.e. it has non-audio interfaces),
prefer the Speaker OUTPUT_TERMINAL's iTerminal string as the card
shortname, instead of the device-level iProduct. If iTerminal is not
set (zero) or not readable via usb_string(), fall back to iProduct
(existing behavior).

Non-composite (dedicated audio) devices are not affected and continue
to use iProduct.

The composite device detection checks whether any interface has a
non-Audio class. The iTerminal reading uses the existing
snd_usb_find_csint_desc() helper to parse OUTPUT_TERMINAL descriptors
in the Audio Control interface's extra data. The iTerminal field is
the last byte of the descriptor, common to both UAC1 (bLength=9) and
UAC2 (bLength=12).

As an immediate fix, I have also prepared a quirk entry for 1ff7:0f33
to override the card shortname to "MAXHUB Speaker" directly.

Questions for the community
----------------------------

1. Is this approach reasonable for composite devices, or should it
   remain a per-device quirk?

2. Are there concerns about changing card names for existing composite
   USB audio devices that have iTerminal set? For example, UCM profile
   matching or PulseAudio device identification.

3. Would it be preferable to also check the IAD's iFunction field
   before falling back to iTerminal, or is iTerminal sufficient?

4. Are there known composite USB audio devices where the iTerminal
   string might be empty or contain unexpected content?

I have tested the quirk approach on a MT81C device (Kylin V10-SP1)
and it works correctly. The iTerminal approach compiles but has not
been tested on multiple devices yet.

Any feedback would be appreciated.

Best regards,
RenPanpan

             reply	other threads:[~2026-10-30  1:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30  1:34 RenPanpan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-10-30 12:17 [DISCUSSION] ALSA: usb-audio: Card naming for composite devices RenPanpan
2026-10-30  2:34 RenPanpan
2026-10-29  9:35 rppxj178543

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=6AE3F43C.0F8E64.00008@m16.mail.163.com \
    --to=rppxj178543@163.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.