alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Mack <zonque@gmail.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, linux@romal.de, clemens@ladisch.de,
	linuxaudio@showlabor.de, Daniel Mack <zonque@gmail.com>
Subject: [PATCH 3/3] ALSA: snd-usb: fix cross-interface streaming devices
Date: Thu, 30 Aug 2012 18:52:31 +0200	[thread overview]
Message-ID: <1346345551-8956-4-git-send-email-zonque@gmail.com> (raw)
In-Reply-To: <1346345551-8956-1-git-send-email-zonque@gmail.com>

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@gmail.com>
Reported-by: Robert M. Albrecht <linux@romal.de>
---
 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;
-- 
1.7.11.4

  parent reply	other threads:[~2012-08-30 16:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30 16:52 [PATCH 0/3] ALSA: snd-usb: Regression fixes for 3.5 Daniel Mack
2012-08-30 16:52 ` [PATCH 1/3] ALSA: snd-usb: restore delay information Daniel Mack
2012-08-30 16:52 ` [PATCH 2/3] ALSA: snd-usb: fix calls to next_packet_size Daniel Mack
2012-08-30 16:52 ` Daniel Mack [this message]
2012-08-30 16:54   ` [PATCH 3/3] ALSA: snd-usb: fix cross-interface streaming devices Daniel Mack
2012-08-31 16:26 ` [PATCH 0/3] ALSA: snd-usb: Regression fixes for 3.5 Takashi Iwai
2012-08-31 16:30   ` Daniel Mack
2012-08-31 23:37     ` Felix Homann
2012-09-04 14:33     ` Takashi Iwai

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=1346345551-8956-4-git-send-email-zonque@gmail.com \
    --to=zonque@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=linux@romal.de \
    --cc=linuxaudio@showlabor.de \
    --cc=tiwai@suse.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 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).