All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: RenPanpan <rppxj178543@163.com>
Cc: alsa-devel@alsa-project.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [DISCUSSION] ALSA: usb-audio: Card naming for composite devices
Date: Sat, 31 Oct 2026 17:57:26 +0100	[thread overview]
Message-ID: <87bj89reo9.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261030121740.250336-1-rppxj178543@163.com>

On Fri, 30 Oct 2026 13:17:39 +0100,
RenPanpan wrote:
> 
> 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

I took your first fix patch as it was simple enough.
(It took time just because I was traveling in the last week.)

If it still doesn't suffice, let us know.  Thanks.


Takashi

  reply	other threads:[~2026-10-31 16:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 12:17 [DISCUSSION] ALSA: usb-audio: Card naming for composite devices RenPanpan
2026-10-31 16:57 ` Takashi Iwai [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-10-30  2:34 RenPanpan
2026-10-30  1: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=87bj89reo9.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rppxj178543@163.com \
    /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.