From: Takashi Iwai <tiwai@suse.de>
To: Lena <lena@nihil.gay>
Cc: alsa-devel@alsa-project.org
Subject: Re: ALSA USB quirk mixer driver question
Date: Wed, 26 Feb 2025 11:22:24 +0100 [thread overview]
Message-ID: <87cyf557kv.wl-tiwai@suse.de> (raw)
In-Reply-To: <6f03b7d6-97d5-48a4-be6f-a1df481971fc@nihil.gay>
On Fri, 14 Feb 2025 13:05:13 +0100,
Lena wrote:
>
> Hi all!
>
> I'm currently trying to develop an usb quirk mixer driver for a
> desktop USB audio interface.
>
> The interface exposes the following:
>
> - interface 0-2 are USB UAC compliant, bound to by snd-usb-audio, and
> working flawlessly
>
> - interface 3 is vendor specific, and we can ignore it (used for
> firmware updates)
>
> - interface 4 exposes a non-standard mixer with a HID interface exposing
> 2 interrupt endpoints, and is used by the vendor windows app.
>
> I have studied the protocol with usbpcap and can successfully talk to
> the interface on the userspace, but i had a question regarding how to
> proceed in the kernel.
>
> This is because, after creating a new entry in `sound/usb/mixer_quirks.c`
> with all the needed controls, userspace can interact with them, etc.
>
> I can't figure out how to tell ALSA to
> bind to the correct interface for the mixer (and kick out usbhid).
> Looking at the other quirk mixer drivers it doesn't look (?) like any
> other quirk mixer driver is binding to a *different* interface, not
> even `sound/usb/mixer_scarlett.c`.
The HID device won't be bound with the sound driver, and the mixer
"quirks" found in USB-audio driver aren't for managing HID interfaces
but only about audio interfaces. That said, what you'd need would be
to write rather a HID driver for the interface. The plumbing of both
interfaces is done in the upper level, typically in user space.
HTH,
Takashi
> Generally, in a standalone USB driver you'd have tracking/teardown
> handled easily with a callback, but i'm having trouble with the
> dependencies here. (simply using `usb_sndintpipe()` or
> `usb_interrupt_msg()` triggers kernel oopses, so that's probably not it)
>
> What i think i have to do is to use `usb_get_intf()`, then i have to
> somehow claim it (does `usb_driver_claim_interface()` work here?). But
> `usb_get_intf()` requires me to then release the interface with
> `usb_put_intf()`, and it doesn't look like there's anywhere for me to do
> that. (`snd_usb_mixer_elem_free()`? doesn't look like the order is
> correct)
>
> `iface_ref_find()` would sorta do what i need, but i cannot use it here.
>
> Could someone please point me in the right direction? I'm very stuck at
> the moment.
>
> Thanks,
>
> Lena
next prev parent reply other threads:[~2025-02-26 10:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 12:05 ALSA USB quirk mixer driver question Lena
2025-02-26 10:22 ` Takashi Iwai [this message]
2025-02-26 23:15 ` Lena
2025-02-27 7:01 ` Takashi Iwai
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=87cyf557kv.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=lena@nihil.gay \
/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.