alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben.hutchings@codethink.co.uk>
To: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>,
	alsa-devel@alsa-project.org
Cc: linux-kernel@lists.codethink.co.uk
Subject: Re: [Linux-kernel] [PATCH 5/6] ALSA: usb: Use Class Specific EP for UAC3 devices.
Date: Wed, 13 Dec 2017 22:55:55 +0000	[thread overview]
Message-ID: <1513205755.18523.273.camel@codethink.co.uk> (raw)
In-Reply-To: <20171129105532.15420-6-jorge.sanjuan@codethink.co.uk>

On Wed, 2017-11-29 at 10:55 +0000, Jorge Sanjuan wrote:
> bmAtributes offset doesn't exist in the UAC3 CS_EP descriptor.
> Hence, checking for pitch control as if it was UAC2 doesn't make
> any sense. Use the defined UAC3 offsets instead.
> 
> Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
> ---
>  sound/usb/stream.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/stream.c b/sound/usb/stream.c
> index 8b3565d4ca24..fbc7e056ee88 100644
> --- a/sound/usb/stream.c
> +++ b/sound/usb/stream.c
> @@ -512,9 +512,11 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,

The check for minimum length of the EP descriptor (just above this)
should also be updated to be version-dependent.

The current check has a hardcoded minimum of 7, which I think will
still cover all the fields being accessed - but that might change in
future.

Ben.

>  		return 0;
>  	}
>  
> -	if (protocol == UAC_VERSION_1) {
> +	switch (protocol) {
> +	case UAC_VERSION_1:
>  		attributes = csep->bmAttributes;
> -	} else {
> +		break;
> +	case UAC_VERSION_2: {
>  		struct uac2_iso_endpoint_descriptor *csep2 =
>  			(struct uac2_iso_endpoint_descriptor *) csep;
>  
> @@ -523,6 +525,17 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
>  		/* emulate the endpoint attributes of a v1 device */
>  		if (csep2->bmControls & UAC2_CONTROL_PITCH)
>  			attributes |= UAC_EP_CS_ATTR_PITCH_CONTROL;
> +		break;
> +	}
> +	case UAC_VERSION_3: {
> +		struct uac3_iso_endpoint_descriptor *csep3 =
> +			(struct uac3_iso_endpoint_descriptor *) csep;
> +
> +		/* emulate the endpoint attributes of a v1 device */
> +		if (csep3->bmControls & UAC3_CONTROL_PITCH)
> +			attributes |= UAC_EP_CS_ATTR_PITCH_CONTROL;
> +		break;
> +	}
>  	}
>  
>  	return attributes;
-- 
Ben Hutchings
Software Developer, Codethink Ltd.

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2017-12-13 22:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29 10:55 [PATCH 0/6] ALSA: usb: UAC3. Add support for Basic Audio Device (BADD) Jorge Sanjuan
2017-11-29 10:55 ` [PATCH 1/6] ALSA: usb: ADC3: Add initial BADD spec support Jorge Sanjuan
2017-12-13 22:48   ` [Linux-kernel] " Ben Hutchings
2017-11-29 10:55 ` [PATCH 2/6] ALSA: usb: ADC3. BADD specification: fixed 48KHz sample rate Jorge Sanjuan
2017-11-29 10:55 ` [PATCH 3/6] ALSA: usb: ADC3. Do not set sample rate for BADD configuration Jorge Sanjuan
2017-11-29 10:55 ` [PATCH 4/6] usb: audio: Fix variable length field to be variable Jorge Sanjuan
2017-11-29 11:33   ` Clemens Ladisch
2017-11-29 10:55 ` [PATCH 5/6] ALSA: usb: Use Class Specific EP for UAC3 devices Jorge Sanjuan
2017-12-13 22:55   ` Ben Hutchings [this message]
2017-11-29 10:55 ` [PATCH 6/6] ALSA: usb: Only get control header for UAC1 class Jorge Sanjuan

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=1513205755.18523.273.camel@codethink.co.uk \
    --to=ben.hutchings@codethink.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=jorge.sanjuan@codethink.co.uk \
    --cc=linux-kernel@lists.codethink.co.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).