All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Rosen <jeremy.rosen@openwide.fr>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: Problem using alsa to implement an Android dock
Date: Thu, 13 Jun 2013 10:24:47 +0200 (CEST)	[thread overview]
Message-ID: <1532812831.335058.1371111887295.JavaMail.root@openwide.fr> (raw)
In-Reply-To: <51B8D55A.8080206@ladisch.de>

Awesome, this works perfectly, thx a lot

tested-by: Jeremy Rosen <jeremy.rosen@openwide.fr>

Is there anything I need to do for the upstreaming ?

I will still open a bug on the android side, though...


    Cordialement

    Jérémy Rosen

fight key loggers : write some perl using vim

----- Mail original -----
> Jeremy Rosen wrote:
> > it didn't seem to work
> 
> Because the important code uses 'interface', not 'iface'.
> Try this one:
> 
> 
> ALSA: usb-audio: work around Anroid accessory firmware bug
> 
> When the Android firmware enables the audio interfaces in accessory
> mode, it always declares in the control interface's baInterfaceNr
> array
> that interfaces 0 and 1 belong to the audio function.  However, the
> accessory interface itself, if also enabled, already is at index 0
> and
> shifts the actual audio interface numbers to 1 and 2, which prevents
> the
> PCM streaming interface from being seen by the host driver.
> 
> To get the PCM interface interface to work, detect when the
> descriptors
> point to the (for this driver useless) accessory interface, and
> redirect
> to the correct one.
> 
> Reported-by: Jeremy Rosen <jeremy.rosen@openwide.fr>
> Not-yet-tested-by: Jeremy Rosen <jeremy.rosen@openwide.fr>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
> ---
>  sound/usb/card.c |   22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index 563854a..5a5153c 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -148,14 +148,32 @@ static int snd_usb_create_stream(struct
> snd_usb_audio *chip, int ctrlif, int int
>  		return -EINVAL;
>  	}
> 
> +	alts = &iface->altsetting[0];
> +	altsd = get_iface_desc(alts);
> +
> +	/*
> +	 * Android with both accessory and audio interfaces enabled gets
> the
> +	 * interface numbers wrong.
> +	 */
> +	if ((chip->usb_id == USB_ID(0x18d1, 0x2d04) ||
> +	     chip->usb_id == USB_ID(0x18d1, 0x2d05)) &&
> +	    interface == 0 &&
> +	    altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
> +	    altsd->bInterfaceSubClass == USB_SUBCLASS_VENDOR_SPEC) {
> +		interface = 2;
> +		iface = usb_ifnum_to_if(dev, interface);
> +		if (!iface)
> +			return -EINVAL;
> +		alts = &iface->altsetting[0];
> +		altsd = get_iface_desc(alts);
> +	}
> +
>  	if (usb_interface_claimed(iface)) {
>  		snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n",
>  						dev->devnum, ctrlif, interface);
>  		return -EINVAL;
>  	}
> 
> -	alts = &iface->altsetting[0];
> -	altsd = get_iface_desc(alts);
>  	if ((altsd->bInterfaceClass == USB_CLASS_AUDIO ||
>  	     altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) &&
>  	    altsd->bInterfaceSubClass == USB_SUBCLASS_MIDISTREAMING) {
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

      reply	other threads:[~2013-06-13  8:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <14938206.164554.1370852219153.JavaMail.root@openwide.fr>
2013-06-10  9:03 ` Problem using alsa to implement an Android dock Jeremy Rosen
2013-06-10 12:02   ` Clemens Ladisch
2013-06-10 12:37     ` Jeremy Rosen
2013-06-11 19:44   ` Clemens Ladisch
2013-06-12 15:16     ` Jeremy Rosen
2013-06-12 15:30       ` Clemens Ladisch
2013-06-12 15:43         ` Jeremy Rosen
2013-06-12 20:08       ` Clemens Ladisch
2013-06-13  8:24         ` Jeremy Rosen [this message]

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=1532812831.335058.1371111887295.JavaMail.root@openwide.fr \
    --to=jeremy.rosen@openwide.fr \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    /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.