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