[alsa-devel] [PATCH 3/3] ALSA: snd-usb: fix cross-interface streaming devices
Daniel Mack
zonque at gmail.com
Thu Aug 30 18:54:18 CEST 2012
On 30.08.2012 18:52, Daniel Mack wrote:
> Commit 68e67f40b ("ALSA: snd-usb: move calls to usb_set_interface")
> saved us some unnecessary calls to snd_usb_set_interface() but ignored
> the fact that there is at least one device out there which operates on
> two endpoint in different interfaces simultaniously.
>
> Take care for this by catching the case where data and sync endpoints
> are located on different interfaces and calling snd_usb_set_interface()
> between the start of the two endpoints.
>
> Signed-off-by: Daniel Mack <zonque at gmail.com>
> Reported-by: Robert M. Albrecht <linux at romal.de>
Cc: stable at kernel.org [v3.5+]
> ---
> sound/usb/pcm.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
> index e80b668..fd5e982 100644
> --- a/sound/usb/pcm.c
> +++ b/sound/usb/pcm.c
> @@ -236,6 +236,21 @@ static int start_endpoints(struct snd_usb_substream *subs, int can_sleep)
> !test_and_set_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) {
> struct snd_usb_endpoint *ep = subs->sync_endpoint;
>
> + if (subs->data_endpoint->iface != subs->sync_endpoint->iface ||
> + subs->data_endpoint->alt_idx != subs->sync_endpoint->alt_idx) {
> + err = usb_set_interface(subs->dev,
> + subs->sync_endpoint->iface,
> + subs->sync_endpoint->alt_idx);
> + if (err < 0) {
> + snd_printk(KERN_ERR
> + "%d:%d:%d: cannot set interface (%d)\n",
> + subs->dev->devnum,
> + subs->sync_endpoint->iface,
> + subs->sync_endpoint->alt_idx, err);
> + return -EIO;
> + }
> + }
> +
> snd_printdd(KERN_DEBUG "Starting sync EP @%p\n", ep);
>
> ep->sync_slave = subs->data_endpoint;
>
More information about the Alsa-devel
mailing list