Re: [PATCH] USB Audio Class 2 Mixer unit support for GET_CUR, SET_CUR and RANGE
From: Takashi Iwai
Date: Thu Sep 17 2026 - 12:26:38 EST
On Thu, 17 Sep 2026 16:23:41 +0200,
Zipdox wrote:
>
>
>
> On 9/16/26 8:22 PM, Takashi Iwai wrote:
> >
> > ... or maybe a less cryptic version like below.
> >
> >
> > Takashi
> >
> > -- 8< --
> > diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> > index 33a6a1281410..c6639a45fb24 100644
> > --- a/sound/usb/mixer.c
> > +++ b/sound/usb/mixer.c
> > @@ -335,6 +335,16 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request,
> > return -EINVAL;
> > }
> > +/* convert the given UAC1 wValue (ICN+1|OCN+1) to UAC2 MCN */
> > +static unsigned int to_mcn(const struct usb_mixer_elem_info *cval,
> > + unsigned int validx)
> > +{
> > + unsigned char m = (validx >> 8) & 0xff;
> > + unsigned char v = validx & 0xff;
> > +
> > + return (m - 1) * cval->num_outputs * (v - 1);
> > +}
> You used multiplication instead of addition for the last part. I
> assume this is a mistake?
Yes, an obvious typo.
> Also you should probably also bitwise and
> that with 0xFF to make sure it's not more than one byte. The product
> of the number of input and output channels must be no greater than 256
> according to the spec. I don't know if this is checked
> elsewhere.
Right, that's already done in another patch, I didn't send the whole
series. Now attached below.
> Other than that it looks good for a patch to get it
> working. I'll try it out and send a follow-up email shortly.
thanks,
Takashi
Attachment:
0001-ALSA-usb-audio-Check-mixer-matrix-size-for-UAC2-3-at.patch
Description: Binary data