All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Regression in sound/usb/
       [not found] <CADYPuQ75GAxGyZgiUwygvnQMmDcL9+NMHNo432kg1RYC7vbfQA@mail.gmail.com>
@ 2012-07-02 12:10 ` Daniel Mack
       [not found]   ` <CADYPuQ5RFJAaFDpT+4XM-JDWzDO5czVAU3A++_HVHjhN=VBhvQ@mail.gmail.com>
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2012-07-02 12:10 UTC (permalink / raw)
  To: Philipp Dreimann; +Cc: Takashi Iwai, alsa-devel, Clemens Ladisch

On 01.07.2012 13:40, Philipp Dreimann wrote:
> Hello,
> 
> my usb webcam, which happens to have a microphone too, stopped working
> using usb2 since I tried kernel 3.5-rc2. (It works using usb3.)

Please try 3.5-rc5. A number of regressions were fixed just recently.

Let me know if that version still causes problems.


Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
       [not found]   ` <CADYPuQ5RFJAaFDpT+4XM-JDWzDO5czVAU3A++_HVHjhN=VBhvQ@mail.gmail.com>
@ 2012-07-03  8:00     ` Takashi Iwai
       [not found]       ` <CADYPuQ4Uj8pq9nZOJemY9kZtSrG-WfG4s90b+a00_KteJXU_Sg@mail.gmail.com>
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2012-07-03  8:00 UTC (permalink / raw)
  To: Philipp Dreimann; +Cc: alsa-devel, Clemens Ladisch, Daniel Mack

At Tue, 3 Jul 2012 09:41:09 +0200,
Philipp Dreimann wrote:
> 
> On 2 July 2012 14:10, Daniel Mack <zonque@gmail.com> wrote:
> > On 01.07.2012 13:40, Philipp Dreimann wrote:
> >> Hello,
> >>
> >> my usb webcam, which happens to have a microphone too, stopped working
> >> using usb2 since I tried kernel 3.5-rc2. (It works using usb3.)
> >
> > Please try 3.5-rc5. A number of regressions were fixed just recently.
> >
> > Let me know if that version still causes problems.
> 
> It still does.

Try to pass ignore_ctl_error=1 to snd-usb-audio module.
If this works and no other problem happens, we can add a similar quirk
like some Logitech webcams.


Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
       [not found]       ` <CADYPuQ4Uj8pq9nZOJemY9kZtSrG-WfG4s90b+a00_KteJXU_Sg@mail.gmail.com>
@ 2012-07-03  8:27         ` Takashi Iwai
       [not found]           ` <CADYPuQ6DT4=NW2tzCLrKYnUHQ6p5qONZjY8PeKq-Z4HAk68tpw@mail.gmail.com>
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2012-07-03  8:27 UTC (permalink / raw)
  To: Philipp Dreimann; +Cc: alsa-devel, Clemens Ladisch, Daniel Mack

At Tue, 3 Jul 2012 10:20:13 +0200,
Philipp Dreimann wrote:
> 
> On 3 July 2012 10:00, Takashi Iwai <tiwai@suse.de> wrote:
> > At Tue, 3 Jul 2012 09:41:09 +0200,
> > Philipp Dreimann wrote:
> >>
> >> On 2 July 2012 14:10, Daniel Mack <zonque@gmail.com> wrote:
> >> > On 01.07.2012 13:40, Philipp Dreimann wrote:
> >> >> Hello,
> >> >>
> >> >> my usb webcam, which happens to have a microphone too, stopped working
> >> >> using usb2 since I tried kernel 3.5-rc2. (It works using usb3.)
> >> >
> >> > Please try 3.5-rc5. A number of regressions were fixed just recently.
> >> >
> >> > Let me know if that version still causes problems.
> >>
> >> It still does.
> >
> > Try to pass ignore_ctl_error=1 to snd-usb-audio module.
> > If this works and no other problem happens, we can add a similar quirk
> > like some Logitech webcams.
> 
> This does not seem to help.

And webcam itself is working with our without snd-usb-audio module?
Which device at all?

Too little information to analyze.


Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
       [not found]           ` <CADYPuQ6DT4=NW2tzCLrKYnUHQ6p5qONZjY8PeKq-Z4HAk68tpw@mail.gmail.com>
@ 2012-07-03  9:01             ` Takashi Iwai
  2012-07-05 14:41               ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2012-07-03  9:01 UTC (permalink / raw)
  To: Philipp Dreimann; +Cc: alsa-devel, Clemens Ladisch, Daniel Mack

At Tue, 3 Jul 2012 10:40:51 +0200,
Philipp Dreimann wrote:
> 
> On 3 July 2012 10:27, Takashi Iwai <tiwai@suse.de> wrote:
> > At Tue, 3 Jul 2012 10:20:13 +0200,
> > Philipp Dreimann wrote:
> >>
> >> On 3 July 2012 10:00, Takashi Iwai <tiwai@suse.de> wrote:
> >> > At Tue, 3 Jul 2012 09:41:09 +0200,
> >> > Philipp Dreimann wrote:
> >> >>
> >> >> On 2 July 2012 14:10, Daniel Mack <zonque@gmail.com> wrote:
> >> >> > On 01.07.2012 13:40, Philipp Dreimann wrote:
> >> >> >> Hello,
> >> >> >>
> >> >> >> my usb webcam, which happens to have a microphone too, stopped working
> >> >> >> using usb2 since I tried kernel 3.5-rc2. (It works using usb3.)
> >> >> >
> >> >> > Please try 3.5-rc5. A number of regressions were fixed just recently.
> >> >> >
> >> >> > Let me know if that version still causes problems.
> >> >>
> >> >> It still does.
> >> >
> >> > Try to pass ignore_ctl_error=1 to snd-usb-audio module.
> >> > If this works and no other problem happens, we can add a similar quirk
> >> > like some Logitech webcams.
> >>
> >> This does not seem to help.
> >
> > And webcam itself is working with our without snd-usb-audio module?
> Yes, if I blacklist the module, the webcam works fine.
> 
> > Which device at all?
> logitech c910
> 
> > Too little information to analyze.
> You guys tell me what you need to know.

Try the patch below.  If it still doesn't work, give the kernel
message again and lsusb -v output, too.


thanks,

Takashi

---
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 54607f8..f0ede13 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -387,7 +387,7 @@ add_sync_ep:
 		subs->data_endpoint->sync_master = subs->sync_endpoint;
 	}
 
-	if ((err = snd_usb_init_pitch(subs->stream->chip, subs->interface, alts, fmt)) < 0)
+	if ((err = snd_usb_init_pitch(subs->stream->chip, fmt->iface, alts, fmt)) < 0)
 		return err;
 
 	subs->cur_audiofmt = fmt;
@@ -450,7 +450,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
 		struct usb_interface *iface;
 		iface = usb_ifnum_to_if(subs->dev, fmt->iface);
 		alts = &iface->altsetting[fmt->altset_idx];
-		ret = snd_usb_init_sample_rate(subs->stream->chip, subs->interface, alts, fmt, rate);
+		ret = snd_usb_init_sample_rate(subs->stream->chip, fmt->iface, alts, fmt, rate);
 		if (ret < 0)
 			return ret;
 		subs->cur_rate = rate;

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
  2012-07-03  9:01             ` Takashi Iwai
@ 2012-07-05 14:41               ` Takashi Iwai
       [not found]                 ` <CADYPuQ7yWpnPSvoVQDV+EyJfC39MDxhP9r5Jiqk_Jh8g65Xd4g@mail.gmail.com>
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2012-07-05 14:41 UTC (permalink / raw)
  To: Philipp Dreimann; +Cc: alsa-devel, Clemens Ladisch, Daniel Mack

At Tue, 03 Jul 2012 11:01:42 +0200,
Takashi Iwai wrote:
> 
> At Tue, 3 Jul 2012 10:40:51 +0200,
> Philipp Dreimann wrote:
> > 
> > On 3 July 2012 10:27, Takashi Iwai <tiwai@suse.de> wrote:
> > > At Tue, 3 Jul 2012 10:20:13 +0200,
> > > Philipp Dreimann wrote:
> > >>
> > >> On 3 July 2012 10:00, Takashi Iwai <tiwai@suse.de> wrote:
> > >> > At Tue, 3 Jul 2012 09:41:09 +0200,
> > >> > Philipp Dreimann wrote:
> > >> >>
> > >> >> On 2 July 2012 14:10, Daniel Mack <zonque@gmail.com> wrote:
> > >> >> > On 01.07.2012 13:40, Philipp Dreimann wrote:
> > >> >> >> Hello,
> > >> >> >>
> > >> >> >> my usb webcam, which happens to have a microphone too, stopped working
> > >> >> >> using usb2 since I tried kernel 3.5-rc2. (It works using usb3.)
> > >> >> >
> > >> >> > Please try 3.5-rc5. A number of regressions were fixed just recently.
> > >> >> >
> > >> >> > Let me know if that version still causes problems.
> > >> >>
> > >> >> It still does.
> > >> >
> > >> > Try to pass ignore_ctl_error=1 to snd-usb-audio module.
> > >> > If this works and no other problem happens, we can add a similar quirk
> > >> > like some Logitech webcams.
> > >>
> > >> This does not seem to help.
> > >
> > > And webcam itself is working with our without snd-usb-audio module?
> > Yes, if I blacklist the module, the webcam works fine.
> > 
> > > Which device at all?
> > logitech c910
> > 
> > > Too little information to analyze.
> > You guys tell me what you need to know.
> 
> Try the patch below.  If it still doesn't work, give the kernel
> message again and lsusb -v output, too.

Did it make any difference?


thanks,

Takashi

> 
> 
> thanks,
> 
> Takashi
> 
> ---
> diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
> index 54607f8..f0ede13 100644
> --- a/sound/usb/pcm.c
> +++ b/sound/usb/pcm.c
> @@ -387,7 +387,7 @@ add_sync_ep:
>  		subs->data_endpoint->sync_master = subs->sync_endpoint;
>  	}
>  
> -	if ((err = snd_usb_init_pitch(subs->stream->chip, subs->interface, alts, fmt)) < 0)
> +	if ((err = snd_usb_init_pitch(subs->stream->chip, fmt->iface, alts, fmt)) < 0)
>  		return err;
>  
>  	subs->cur_audiofmt = fmt;
> @@ -450,7 +450,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
>  		struct usb_interface *iface;
>  		iface = usb_ifnum_to_if(subs->dev, fmt->iface);
>  		alts = &iface->altsetting[fmt->altset_idx];
> -		ret = snd_usb_init_sample_rate(subs->stream->chip, subs->interface, alts, fmt, rate);
> +		ret = snd_usb_init_sample_rate(subs->stream->chip, fmt->iface, alts, fmt, rate);
>  		if (ret < 0)
>  			return ret;
>  		subs->cur_rate = rate;

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
       [not found]                 ` <CADYPuQ7yWpnPSvoVQDV+EyJfC39MDxhP9r5Jiqk_Jh8g65Xd4g@mail.gmail.com>
@ 2012-07-05 15:36                   ` Takashi Iwai
  2012-07-10 21:14                     ` Daniel Mack
  2012-07-05 15:57                   ` Daniel Mack
  1 sibling, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2012-07-05 15:36 UTC (permalink / raw)
  To: Philipp Dreimann; +Cc: alsa-devel, Clemens Ladisch, Daniel Mack

At Thu, 5 Jul 2012 17:32:30 +0200,
Philipp Dreimann wrote:
> 
> On 5 July 2012 16:41, Takashi Iwai <tiwai@suse.de> wrote:
> >> Try the patch below.  If it still doesn't work, give the kernel
> >> message again and lsusb -v output, too.
> >
> > Did it make any difference?
> 
> No, it unfortunately did not.
> 
> lsusb is attached and the parts of the kernel log are in the mail:
> 
> [   41.243211] usb 2-1.2: new high-speed USB device number 3 using ehci_hcd
> [   41.605666] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
> [   42.002275] input: UVC Camera (046d:0821) as
> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input12
> [   42.085880] usbcore: registered new interface driver snd-usb-audio
> 
> [   52.790139] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
> unit 2: -71 (exp. 2).
> [   52.794363] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
> unit 2: -71 (exp. 2).
> [   52.798375] uvcvideo: Failed to query (GET_DEF) UVC control 3 on
> unit 2: -71 (exp. 2).
> [   52.802499] uvcvideo: Failed to query (GET_DEF) UVC control 7 on
> unit 2: -71 (exp. 2).
> [   52.806617] uvcvideo: Failed to query (GET_DEF) UVC control 11 on
> unit 2: -71 (exp. 1).
> [   52.810734] uvcvideo: Failed to query (GET_DEF) UVC control 4 on
> unit 2: -71 (exp. 2).
> [   52.814855] uvcvideo: Failed to query (GET_DEF) UVC control 5 on
> unit 2: -71 (exp. 1).
> [   52.818976] uvcvideo: Failed to query (GET_CUR) UVC control 11 on
> unit 2: -71 (exp. 1).
> [   52.823096] uvcvideo: Failed to query (GET_DEF) UVC control 8 on
> unit 2: -71 (exp. 2).
> [   52.827215] uvcvideo: Failed to query (GET_DEF) UVC control 1 on
> unit 2: -71 (exp. 2).
> [   52.831331] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
> [   52.835459] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
> The last line repeats a few times, then the Failed to query block
> repeats again, and so on. But only if I try to use the webcam.
> 
> [   82.363599] 3:1:3: cannot set freq 32000 to ep 0x86
> Is showing up without using the webcam.

Hm, it looks better than before (it was '3:-1:3' or such), but there
is still something strange there.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
       [not found]                 ` <CADYPuQ7yWpnPSvoVQDV+EyJfC39MDxhP9r5Jiqk_Jh8g65Xd4g@mail.gmail.com>
  2012-07-05 15:36                   ` Takashi Iwai
@ 2012-07-05 15:57                   ` Daniel Mack
  1 sibling, 0 replies; 13+ messages in thread
From: Daniel Mack @ 2012-07-05 15:57 UTC (permalink / raw)
  To: Philipp Dreimann; +Cc: Takashi Iwai, alsa-devel, Clemens Ladisch

On 05.07.2012 17:32, Philipp Dreimann wrote:
> On 5 July 2012 16:41, Takashi Iwai <tiwai@suse.de> wrote:
>>> Try the patch below.  If it still doesn't work, give the kernel
>>> message again and lsusb -v output, too.
>>
>> Did it make any difference?
> 
> No, it unfortunately did not.
> 
> lsusb is attached and the parts of the kernel log are in the mail:
> 
> [   41.243211] usb 2-1.2: new high-speed USB device number 3 using ehci_hcd
> [   41.605666] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
> [   42.002275] input: UVC Camera (046d:0821) as
> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input12
> [   42.085880] usbcore: registered new interface driver snd-usb-audio
> 
> [   52.790139] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
> unit 2: -71 (exp. 2).
> [   52.794363] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
> unit 2: -71 (exp. 2).
> [   52.798375] uvcvideo: Failed to query (GET_DEF) UVC control 3 on
> unit 2: -71 (exp. 2).
> [   52.802499] uvcvideo: Failed to query (GET_DEF) UVC control 7 on
> unit 2: -71 (exp. 2).
> [   52.806617] uvcvideo: Failed to query (GET_DEF) UVC control 11 on
> unit 2: -71 (exp. 1).
> [   52.810734] uvcvideo: Failed to query (GET_DEF) UVC control 4 on
> unit 2: -71 (exp. 2).
> [   52.814855] uvcvideo: Failed to query (GET_DEF) UVC control 5 on
> unit 2: -71 (exp. 1).
> [   52.818976] uvcvideo: Failed to query (GET_CUR) UVC control 11 on
> unit 2: -71 (exp. 1).
> [   52.823096] uvcvideo: Failed to query (GET_DEF) UVC control 8 on
> unit 2: -71 (exp. 2).
> [   52.827215] uvcvideo: Failed to query (GET_DEF) UVC control 1 on
> unit 2: -71 (exp. 2).
> [   52.831331] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
> [   52.835459] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
> The last line repeats a few times, then the Failed to query block
> repeats again, and so on. But only if I try to use the webcam.
> 
> [   82.363599] 3:1:3: cannot set freq 32000 to ep 0x86
> Is showing up without using the webcam.
> 

What really puzzles me is that the uvcvideo code fails as well, and even
before the sound driver bails out. If you wouldn't have bisected the
problem, I would clearly blame some other change for that.

It seems something confuses the device quite badly so requests to it
return -EPROTO. From a quick grep, this error can only be originated
from low-level EHCI functions.

I need to ponder on that a little ...


Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
  2012-07-05 15:36                   ` Takashi Iwai
@ 2012-07-10 21:14                     ` Daniel Mack
       [not found]                       ` <CADYPuQ6XRSAxKvctCr3FrJ71smk-xOEMF_5VAv-6F5gdM7dwuQ@mail.gmail.com>
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2012-07-10 21:14 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: alsa-devel, Clemens Ladisch, Philipp Dreimann, Joseph Salisbury

[-- Attachment #1: Type: text/plain, Size: 2541 bytes --]

On 05.07.2012 17:36, Takashi Iwai wrote:
> At Thu, 5 Jul 2012 17:32:30 +0200,
> Philipp Dreimann wrote:
>>
>> On 5 July 2012 16:41, Takashi Iwai <tiwai@suse.de> wrote:
>>>> Try the patch below.  If it still doesn't work, give the kernel
>>>> message again and lsusb -v output, too.
>>>
>>> Did it make any difference?
>>
>> No, it unfortunately did not.
>>
>> lsusb is attached and the parts of the kernel log are in the mail:
>>
>> [   41.243211] usb 2-1.2: new high-speed USB device number 3 using ehci_hcd
>> [   41.605666] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
>> [   42.002275] input: UVC Camera (046d:0821) as
>> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input12
>> [   42.085880] usbcore: registered new interface driver snd-usb-audio
>>
>> [   52.790139] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
>> unit 2: -71 (exp. 2).
>> [   52.794363] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
>> unit 2: -71 (exp. 2).
>> [   52.798375] uvcvideo: Failed to query (GET_DEF) UVC control 3 on
>> unit 2: -71 (exp. 2).
>> [   52.802499] uvcvideo: Failed to query (GET_DEF) UVC control 7 on
>> unit 2: -71 (exp. 2).
>> [   52.806617] uvcvideo: Failed to query (GET_DEF) UVC control 11 on
>> unit 2: -71 (exp. 1).
>> [   52.810734] uvcvideo: Failed to query (GET_DEF) UVC control 4 on
>> unit 2: -71 (exp. 2).
>> [   52.814855] uvcvideo: Failed to query (GET_DEF) UVC control 5 on
>> unit 2: -71 (exp. 1).
>> [   52.818976] uvcvideo: Failed to query (GET_CUR) UVC control 11 on
>> unit 2: -71 (exp. 1).
>> [   52.823096] uvcvideo: Failed to query (GET_DEF) UVC control 8 on
>> unit 2: -71 (exp. 2).
>> [   52.827215] uvcvideo: Failed to query (GET_DEF) UVC control 1 on
>> unit 2: -71 (exp. 2).
>> [   52.831331] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
>> [   52.835459] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
>> The last line repeats a few times, then the Failed to query block
>> repeats again, and so on. But only if I try to use the webcam.
>>
>> [   82.363599] 3:1:3: cannot set freq 32000 to ep 0x86
>> Is showing up without using the webcam.
> 
> Hm, it looks better than before (it was '3:-1:3' or such), but there
> is still something strange there.

Sorry for the long delay on this. I finally found some time to look into
this and it seems that I got the calls to usb_set_interface wrong.
Attached is a patch to fix this - could everybody who is affect please
give that a quick try? More explanation is in the commit log.


Thanks,
Daniel



[-- Attachment #2: 0001-ALSA-snd-usb-fix-calls-to-usb_set_interface.patch --]
[-- Type: text/x-patch, Size: 3644 bytes --]

>From 1b8ebc9974c16b8587bdce3ca9a4435c8ef8141e Mon Sep 17 00:00:00 2001
From: Daniel Mack <zonque@gmail.com>
Date: Tue, 10 Jul 2012 22:52:56 +0200
Subject: [PATCH] ALSA: snd-usb: fix calls to usb_set_interface

Don't call usb_set_interface() on snd_usb_endpoint creation and also
drop it from snd_usb_endpoint_deactivate(). Rather unselect the the
active interface before choosing a new alt setting upon the next stream
start.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
 sound/usb/endpoint.c |   45 ++++++++++++++-------------------------------
 1 file changed, 14 insertions(+), 31 deletions(-)

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index e690690..2226769 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -414,7 +414,7 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
 {
 	struct list_head *p;
 	struct snd_usb_endpoint *ep;
-	int ret, is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK;
+	int is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK;
 
 	mutex_lock(&chip->mutex);
 
@@ -434,16 +434,6 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
 		    type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync",
 		    ep_num);
 
-	/* select the alt setting once so the endpoints become valid */
-	ret = usb_set_interface(chip->dev, alts->desc.bInterfaceNumber,
-				alts->desc.bAlternateSetting);
-	if (ret < 0) {
-		snd_printk(KERN_ERR "%s(): usb_set_interface() failed, ret = %d\n",
-					__func__, ret);
-		ep = NULL;
-		goto __exit_unlock;
-	}
-
 	ep = kzalloc(sizeof(*ep), GFP_KERNEL);
 	if (!ep)
 		goto __exit_unlock;
@@ -936,8 +926,8 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
  *
  * In case of any active users, this functions does nothing.
  *
- * Returns an error if usb_set_interface() failed, 0 in all other
- * cases.
+ * Returns an error if any of the usb_set_interface() calls failed, 0 in
+ * all other cases.
  */
 int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep)
 {
@@ -948,6 +938,14 @@ int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep)
 	    !test_and_set_bit(EP_FLAG_ACTIVATED, &ep->flags)) {
 		int ret;
 
+		ret = usb_set_interface(ep->chip->dev, ep->iface, 0);
+		if (ret < 0) {
+			snd_printk(KERN_ERR "%s() usb_set_interface() failed, ret = %d\n",
+						__func__, ret);
+			clear_bit(EP_FLAG_ACTIVATED, &ep->flags);
+			return ret;
+		}
+
 		ret = usb_set_interface(ep->chip->dev, ep->iface, ep->alt_idx);
 		if (ret < 0) {
 			snd_printk(KERN_ERR "%s() usb_set_interface() failed, ret = %d\n",
@@ -967,13 +965,8 @@ int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep)
  *
  * @ep: the endpoint to deactivate
  *
- * If the endpoint is not currently in use, this functions will select the
- * alternate interface setting 0 for the interface of this endpoint.
- *
- * In case of any active users, this functions does nothing.
- *
- * Returns an error if usb_set_interface() failed, 0 in all other
- * cases.
+ * Returns 0 on success, -EINVAL if ep was NULL and -EBUSY if the endpoint
+ * is still in use.
  */
 int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
 {
@@ -984,18 +977,8 @@ int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
 		return 0;
 
 	if (!ep->chip->shutdown &&
-	    test_and_clear_bit(EP_FLAG_ACTIVATED, &ep->flags)) {
-		int ret;
-
-		ret = usb_set_interface(ep->chip->dev, ep->iface, 0);
-		if (ret < 0) {
-			snd_printk(KERN_ERR "%s(): usb_set_interface() failed, ret = %d\n",
-						__func__, ret);
-			return ret;
-		}
-
+	    test_and_clear_bit(EP_FLAG_ACTIVATED, &ep->flags))
 		return 0;
-	}
 
 	return -EBUSY;
 }
-- 
1.7.10.4


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
       [not found]                       ` <CADYPuQ6XRSAxKvctCr3FrJ71smk-xOEMF_5VAv-6F5gdM7dwuQ@mail.gmail.com>
@ 2012-07-11  8:31                         ` Daniel Mack
       [not found]                           ` <4FFD9B29.1020403@canonical.com>
  2012-07-11 23:10                         ` Daniel Mack
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2012-07-11  8:31 UTC (permalink / raw)
  To: Philipp Dreimann
  Cc: Takashi Iwai, alsa-devel, Clemens Ladisch, Joseph Salisbury

On 11.07.2012 09:30, Philipp Dreimann wrote:
> On 10 July 2012 23:14, Daniel Mack <zonque@gmail.com> wrote:
>> On 05.07.2012 17:36, Takashi Iwai wrote:
>>> At Thu, 5 Jul 2012 17:32:30 +0200,
>>> Philipp Dreimann wrote:
>>>>
>>>> On 5 July 2012 16:41, Takashi Iwai <tiwai@suse.de> wrote:
>>>>>> Try the patch below.  If it still doesn't work, give the kernel
>>>>>> message again and lsusb -v output, too.
>>>>>
>>>>> Did it make any difference?
>>>>
>>>> No, it unfortunately did not.
>>>>
>>>> lsusb is attached and the parts of the kernel log are in the mail:
>>>>
>>>> [   41.243211] usb 2-1.2: new high-speed USB device number 3 using ehci_hcd
>>>> [   41.605666] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
>>>> [   42.002275] input: UVC Camera (046d:0821) as
>>>> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input12
>>>> [   42.085880] usbcore: registered new interface driver snd-usb-audio
>>>>
>>>> [   52.790139] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
>>>> unit 2: -71 (exp. 2).
>>>> [   52.794363] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
>>>> unit 2: -71 (exp. 2).
>>>> [   52.798375] uvcvideo: Failed to query (GET_DEF) UVC control 3 on
>>>> unit 2: -71 (exp. 2).
>>>> [   52.802499] uvcvideo: Failed to query (GET_DEF) UVC control 7 on
>>>> unit 2: -71 (exp. 2).
>>>> [   52.806617] uvcvideo: Failed to query (GET_DEF) UVC control 11 on
>>>> unit 2: -71 (exp. 1).
>>>> [   52.810734] uvcvideo: Failed to query (GET_DEF) UVC control 4 on
>>>> unit 2: -71 (exp. 2).
>>>> [   52.814855] uvcvideo: Failed to query (GET_DEF) UVC control 5 on
>>>> unit 2: -71 (exp. 1).
>>>> [   52.818976] uvcvideo: Failed to query (GET_CUR) UVC control 11 on
>>>> unit 2: -71 (exp. 1).
>>>> [   52.823096] uvcvideo: Failed to query (GET_DEF) UVC control 8 on
>>>> unit 2: -71 (exp. 2).
>>>> [   52.827215] uvcvideo: Failed to query (GET_DEF) UVC control 1 on
>>>> unit 2: -71 (exp. 2).
>>>> [   52.831331] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
>>>> [   52.835459] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
>>>> The last line repeats a few times, then the Failed to query block
>>>> repeats again, and so on. But only if I try to use the webcam.
>>>>
>>>> [   82.363599] 3:1:3: cannot set freq 32000 to ep 0x86
>>>> Is showing up without using the webcam.
>>>
>>> Hm, it looks better than before (it was '3:-1:3' or such), but there
>>> is still something strange there.
>>
>> Sorry for the long delay on this. I finally found some time to look into
>> this and it seems that I got the calls to usb_set_interface wrong.
>> Attached is a patch to fix this - could everybody who is affect please
>> give that a quick try? More explanation is in the commit log.
> 
> The camera is now working for a short time:
> [   56.421399] usb 2-1.2: new high-speed USB device number 4 using ehci_hcd
> [   57.224234] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
> [   57.237221] input: UVC Camera (046d:0821) as
> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input15
> Camera and microphone are working. Some time later we're back to the old issue:

Ok, I see. Drop this, I'm working on a new one. I will find some time
later today to look into this. Thanks for your patience!


Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
       [not found]                           ` <4FFD9B29.1020403@canonical.com>
@ 2012-07-11 15:28                             ` Daniel Mack
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Mack @ 2012-07-11 15:28 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: Takashi Iwai, alsa-devel, Clemens Ladisch, Philipp Dreimann

On 11.07.2012 17:26, Joseph Salisbury wrote:
> On 07/11/2012 04:31 AM, Daniel Mack wrote:
>> On 11.07.2012 09:30, Philipp Dreimann wrote:
>>> On 10 July 2012 23:14, Daniel Mack <zonque@gmail.com> wrote:
>>>> On 05.07.2012 17:36, Takashi Iwai wrote:
>>>>> At Thu, 5 Jul 2012 17:32:30 +0200,
>>>>> Philipp Dreimann wrote:
>>>>>>
>>>>>> On 5 July 2012 16:41, Takashi Iwai <tiwai@suse.de> wrote:
>>>>>>>> Try the patch below.  If it still doesn't work, give the kernel
>>>>>>>> message again and lsusb -v output, too.
>>>>>>>
>>>>>>> Did it make any difference?
>>>>>>
>>>>>> No, it unfortunately did not.
>>>>>>
>>>>>> lsusb is attached and the parts of the kernel log are in the mail:
>>>>>>
>>>>>> [   41.243211] usb 2-1.2: new high-speed USB device number 3 using ehci_hcd
>>>>>> [   41.605666] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
>>>>>> [   42.002275] input: UVC Camera (046d:0821) as
>>>>>> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input12
>>>>>> [   42.085880] usbcore: registered new interface driver snd-usb-audio
>>>>>>
>>>>>> [   52.790139] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
>>>>>> unit 2: -71 (exp. 2).
>>>>>> [   52.794363] uvcvideo: Failed to query (GET_DEF) UVC control 2 on
>>>>>> unit 2: -71 (exp. 2).
>>>>>> [   52.798375] uvcvideo: Failed to query (GET_DEF) UVC control 3 on
>>>>>> unit 2: -71 (exp. 2).
>>>>>> [   52.802499] uvcvideo: Failed to query (GET_DEF) UVC control 7 on
>>>>>> unit 2: -71 (exp. 2).
>>>>>> [   52.806617] uvcvideo: Failed to query (GET_DEF) UVC control 11 on
>>>>>> unit 2: -71 (exp. 1).
>>>>>> [   52.810734] uvcvideo: Failed to query (GET_DEF) UVC control 4 on
>>>>>> unit 2: -71 (exp. 2).
>>>>>> [   52.814855] uvcvideo: Failed to query (GET_DEF) UVC control 5 on
>>>>>> unit 2: -71 (exp. 1).
>>>>>> [   52.818976] uvcvideo: Failed to query (GET_CUR) UVC control 11 on
>>>>>> unit 2: -71 (exp. 1).
>>>>>> [   52.823096] uvcvideo: Failed to query (GET_DEF) UVC control 8 on
>>>>>> unit 2: -71 (exp. 2).
>>>>>> [   52.827215] uvcvideo: Failed to query (GET_DEF) UVC control 1 on
>>>>>> unit 2: -71 (exp. 2).
>>>>>> [   52.831331] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
>>>>>> [   52.835459] uvcvideo: Failed to set UVC probe control : -71 (exp. 26).
>>>>>> The last line repeats a few times, then the Failed to query block
>>>>>> repeats again, and so on. But only if I try to use the webcam.
>>>>>>
>>>>>> [   82.363599] 3:1:3: cannot set freq 32000 to ep 0x86
>>>>>> Is showing up without using the webcam.
>>>>>
>>>>> Hm, it looks better than before (it was '3:-1:3' or such), but there
>>>>> is still something strange there.
>>>>
>>>> Sorry for the long delay on this. I finally found some time to look into
>>>> this and it seems that I got the calls to usb_set_interface wrong.
>>>> Attached is a patch to fix this - could everybody who is affect please
>>>> give that a quick try? More explanation is in the commit log.
>>>
>>> The camera is now working for a short time:
>>> [   56.421399] usb 2-1.2: new high-speed USB device number 4 using ehci_hcd
>>> [   57.224234] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
>>> [   57.237221] input: UVC Camera (046d:0821) as
>>> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input15
>>> Camera and microphone are working. Some time later we're back to the old issue:
>>
>> Ok, I see. Drop this, I'm working on a new one. I will find some time
>> later today to look into this. Thanks for your patience!
>>
>>
>> Daniel
> 
> I just sent an email to Philipp that I've been unable to reproduce the
> failure on my hardware.  However, a user testing your patch has also run
> into the same failure as Philipp:
> 
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1018020/comments/38
> 
> That users webcam will work up to 15 minutes, than fail.

I'll pick up an USB hw analyzer later today and then try with a Logitech
camera. Will keep you posted.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
       [not found]                       ` <CADYPuQ6XRSAxKvctCr3FrJ71smk-xOEMF_5VAv-6F5gdM7dwuQ@mail.gmail.com>
  2012-07-11  8:31                         ` Daniel Mack
@ 2012-07-11 23:10                         ` Daniel Mack
  2012-07-11 23:41                           ` Daniel Mack
       [not found]                           ` <CADYPuQ5sE28JRXLaBUYzjqvuJyWY9cWUCM4mYFByYQUXppDOQA@mail.gmail.com>
  1 sibling, 2 replies; 13+ messages in thread
From: Daniel Mack @ 2012-07-11 23:10 UTC (permalink / raw)
  To: Philipp Dreimann
  Cc: Takashi Iwai, alsa-devel, Clemens Ladisch, Joseph Salisbury

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

On 11.07.2012 09:30, Philipp Dreimann wrote:

> The camera is now working for a short time:
> [   56.421399] usb 2-1.2: new high-speed USB device number 4 using ehci_hcd
> [   57.224234] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
> [   57.237221] input: UVC Camera (046d:0821) as
> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input15
> Camera and microphone are working. Some time later we're back to the old issue:

So I found the reason for this breakage now. It's about orphaned packets
that are sent over the wire after alt setting 0 has been selected. The
chipset doesn't like these at and bails out with protocol errors. Fixing
this involves some rework of the logic. The patch is unfortunately a
little big, but I see no option than getting it merged for 3.6.

Everyone, please test - and sorry for the trouble caused.


Thanks,
Daniel

[-- Attachment #2: snd-usb-endpoint-fixups.diff --]
[-- Type: text/x-patch, Size: 7788 bytes --]

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index e690690..4bc5778 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -350,7 +350,8 @@ static void snd_complete_urb(struct urb *urb)
 		     urb->status == -ENODEV ||		/* device removed */
 		     urb->status == -ECONNRESET ||	/* unlinked */
 		     urb->status == -ESHUTDOWN ||	/* device disabled */
-		     ep->chip->shutdown))		/* device disconnected */
+		     ep->chip->shutdown) ||		/* device disconnected */
+		     !test_bit(EP_FLAG_RUNNING, &ep->flags))
 		goto exit_clear;
 
 	if (usb_pipeout(ep->pipe)) {
@@ -414,7 +415,7 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
 {
 	struct list_head *p;
 	struct snd_usb_endpoint *ep;
-	int ret, is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK;
+	int is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK;
 
 	mutex_lock(&chip->mutex);
 
@@ -434,16 +435,6 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
 		    type == SND_USB_ENDPOINT_TYPE_DATA ? "data" : "sync",
 		    ep_num);
 
-	/* select the alt setting once so the endpoints become valid */
-	ret = usb_set_interface(chip->dev, alts->desc.bInterfaceNumber,
-				alts->desc.bAlternateSetting);
-	if (ret < 0) {
-		snd_printk(KERN_ERR "%s(): usb_set_interface() failed, ret = %d\n",
-					__func__, ret);
-		ep = NULL;
-		goto __exit_unlock;
-	}
-
 	ep = kzalloc(sizeof(*ep), GFP_KERNEL);
 	if (!ep)
 		goto __exit_unlock;
@@ -522,13 +513,13 @@ static int deactivate_urbs(struct snd_usb_endpoint *ep, int force, int can_sleep
 	unsigned int i;
 	int async;
 
+	clear_bit(EP_FLAG_RUNNING, &ep->flags);
+
 	if (!force && ep->chip->shutdown) /* to be sure... */
 		return -EBADFD;
 
 	async = !can_sleep && ep->chip->async_unlink;
 
-	clear_bit(EP_FLAG_RUNNING, &ep->flags);
-
 	INIT_LIST_HEAD(&ep->ready_playback_urbs);
 	ep->next_packet_read_pos = 0;
 	ep->next_packet_write_pos = 0;
@@ -831,9 +822,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
 	if (++ep->use_count != 1)
 		return 0;
 
-	if (snd_BUG_ON(!test_bit(EP_FLAG_ACTIVATED, &ep->flags)))
-		return -EINVAL;
-
 	/* just to be sure */
 	deactivate_urbs(ep, 0, 1);
 	wait_clear_urbs(ep);
@@ -911,9 +899,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
 	if (snd_BUG_ON(ep->use_count == 0))
 		return;
 
-	if (snd_BUG_ON(!test_bit(EP_FLAG_ACTIVATED, &ep->flags)))
-		return;
-
 	if (--ep->use_count == 0) {
 		deactivate_urbs(ep, force, can_sleep);
 		ep->data_subs = NULL;
@@ -927,42 +912,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
 }
 
 /**
- * snd_usb_endpoint_activate: activate an snd_usb_endpoint
- *
- * @ep: the endpoint to activate
- *
- * If the endpoint is not currently in use, this functions will select the
- * correct alternate interface setting for the interface of this endpoint.
- *
- * In case of any active users, this functions does nothing.
- *
- * Returns an error if usb_set_interface() failed, 0 in all other
- * cases.
- */
-int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep)
-{
-	if (ep->use_count != 0)
-		return 0;
-
-	if (!ep->chip->shutdown &&
-	    !test_and_set_bit(EP_FLAG_ACTIVATED, &ep->flags)) {
-		int ret;
-
-		ret = usb_set_interface(ep->chip->dev, ep->iface, ep->alt_idx);
-		if (ret < 0) {
-			snd_printk(KERN_ERR "%s() usb_set_interface() failed, ret = %d\n",
-						__func__, ret);
-			clear_bit(EP_FLAG_ACTIVATED, &ep->flags);
-			return ret;
-		}
-
-		return 0;
-	}
-
-	return -EBUSY;
-}
-
-/**
  * snd_usb_endpoint_deactivate: deactivate an snd_usb_endpoint
  *
  * @ep: the endpoint to deactivate
@@ -980,24 +929,15 @@ int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
 	if (!ep)
 		return -EINVAL;
 
+	deactivate_urbs(ep, 1, 1);
+	wait_clear_urbs(ep);
+
 	if (ep->use_count != 0)
 		return 0;
 
-	if (!ep->chip->shutdown &&
-	    test_and_clear_bit(EP_FLAG_ACTIVATED, &ep->flags)) {
-		int ret;
-
-		ret = usb_set_interface(ep->chip->dev, ep->iface, 0);
-		if (ret < 0) {
-			snd_printk(KERN_ERR "%s(): usb_set_interface() failed, ret = %d\n",
-						__func__, ret);
-			return ret;
-		}
+	clear_bit(EP_FLAG_ACTIVATED, &ep->flags);
 
-		return 0;
-	}
-
-	return -EBUSY;
+	return 0;
 }
 
 /**
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 54607f8..536b706 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -261,19 +261,6 @@ static void stop_endpoints(struct snd_usb_substream *subs,
 				      force, can_sleep, wait);
 }
 
-static int activate_endpoints(struct snd_usb_substream *subs)
-{
-	if (subs->sync_endpoint) {
-		int ret;
-
-		ret = snd_usb_endpoint_activate(subs->sync_endpoint);
-		if (ret < 0)
-			return ret;
-	}
-
-	return snd_usb_endpoint_activate(subs->data_endpoint);
-}
-
 static int deactivate_endpoints(struct snd_usb_substream *subs)
 {
 	int reta, retb;
@@ -314,6 +301,31 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
 	if (fmt == subs->cur_audiofmt)
 		return 0;
 
+        /* close the old interface */
+        if (subs->interface >= 0 && subs->interface != fmt->iface) {
+                err = usb_set_interface(subs->dev, subs->interface, 0);
+		if (err < 0) {
+                        snd_printk(KERN_ERR "%d:%d:%d: return to setting 0 failed (%d)\n",
+                                dev->devnum, fmt->iface, fmt->altsetting, err);
+                        return -EIO;
+                }
+                subs->interface = -1;
+                subs->altset_idx = 0;
+        }
+
+        /* set interface */
+        if (subs->interface != fmt->iface || subs->altset_idx != fmt->altset_idx) {
+                err = usb_set_interface(dev, fmt->iface, fmt->altsetting);
+		if (err < 0) {
+                        snd_printk(KERN_ERR "%d:%d:%d: usb_set_interface failed (%d)\n",
+                                   dev->devnum, fmt->iface, fmt->altsetting, err);
+                        return -EIO;
+                }
+                snd_printdd(KERN_INFO "setting usb interface %d:%d\n", fmt->iface, fmt->altsetting);
+                subs->interface = fmt->iface;
+                subs->altset_idx = fmt->altset_idx;
+        }
+
 	subs->data_endpoint = snd_usb_add_endpoint(subs->stream->chip,
 						   alts, fmt->endpoint, subs->direction,
 						   SND_USB_ENDPOINT_TYPE_DATA);
@@ -460,12 +472,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
 		mutex_lock(&subs->stream->chip->shutdown_mutex);
 		/* format changed */
 		stop_endpoints(subs, 0, 0, 0);
-		deactivate_endpoints(subs);
-
-		ret = activate_endpoints(subs);
-		if (ret < 0)
-			goto unlock;
-
 		ret = snd_usb_endpoint_set_params(subs->data_endpoint, hw_params, fmt,
 						  subs->sync_endpoint);
 		if (ret < 0)
@@ -500,6 +506,7 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
 	subs->period_bytes = 0;
 	mutex_lock(&subs->stream->chip->shutdown_mutex);
 	stop_endpoints(subs, 0, 1, 1);
+	deactivate_endpoints(subs);
 	mutex_unlock(&subs->stream->chip->shutdown_mutex);
 	return snd_pcm_lib_free_vmalloc_buffer(substream);
 }
@@ -938,16 +945,20 @@ static int snd_usb_pcm_open(struct snd_pcm_substream *substream, int direction)
 
 static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction)
 {
-	int ret;
 	struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
 	struct snd_usb_substream *subs = &as->substream[direction];
 
 	stop_endpoints(subs, 0, 0, 0);
-	ret = deactivate_endpoints(subs);
+
+        if (!as->chip->shutdown && subs->interface >= 0) {
+                usb_set_interface(subs->dev, subs->interface, 0);
+                subs->interface = -1;
+        }
+
 	subs->pcm_substream = NULL;
 	snd_usb_autosuspend(subs->stream->chip);
 
-	return ret;
+	return 0;
 }
 
 /* Since a URB can handle only a single linear buffer, we must use double

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
  2012-07-11 23:10                         ` Daniel Mack
@ 2012-07-11 23:41                           ` Daniel Mack
       [not found]                           ` <CADYPuQ5sE28JRXLaBUYzjqvuJyWY9cWUCM4mYFByYQUXppDOQA@mail.gmail.com>
  1 sibling, 0 replies; 13+ messages in thread
From: Daniel Mack @ 2012-07-11 23:41 UTC (permalink / raw)
  To: Philipp Dreimann
  Cc: Takashi Iwai, alsa-devel, Clemens Ladisch, Joseph Salisbury

On 12.07.2012 01:10, Daniel Mack wrote:
> On 11.07.2012 09:30, Philipp Dreimann wrote:
> 
>> The camera is now working for a short time:
>> [   56.421399] usb 2-1.2: new high-speed USB device number 4 using ehci_hcd
>> [   57.224234] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
>> [   57.237221] input: UVC Camera (046d:0821) as
>> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input15
>> Camera and microphone are working. Some time later we're back to the old issue:
> 
> So I found the reason for this breakage now. It's about orphaned packets
> that are sent over the wire after alt setting 0 has been selected. The
> chipset doesn't like these at and bails out with protocol errors. Fixing
> this involves some rework of the logic. The patch is unfortunately a
> little big, but I see no option than getting it merged for 3.6.

I meant 3.5, of course.

> Everyone, please test - and sorry for the trouble caused.

To avoid confusion: this patch replaces the other one I sent.


Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Regression in sound/usb/
       [not found]                           ` <CADYPuQ5sE28JRXLaBUYzjqvuJyWY9cWUCM4mYFByYQUXppDOQA@mail.gmail.com>
@ 2012-07-12 13:20                             ` Daniel Mack
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Mack @ 2012-07-12 13:20 UTC (permalink / raw)
  To: Philipp Dreimann
  Cc: Takashi Iwai, alsa-devel, Clemens Ladisch, Joseph Salisbury

On 12.07.2012 11:18, Philipp Dreimann wrote:
> On 12 July 2012 01:10, Daniel Mack <zonque@gmail.com> wrote:
>> On 11.07.2012 09:30, Philipp Dreimann wrote:
>>
>>> The camera is now working for a short time:
>>> [   56.421399] usb 2-1.2: new high-speed USB device number 4 using ehci_hcd
>>> [   57.224234] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0821)
>>> [   57.237221] input: UVC Camera (046d:0821) as
>>> /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.2/input/input15
>>> Camera and microphone are working. Some time later we're back to the old issue:
>>
>> So I found the reason for this breakage now. It's about orphaned packets
>> that are sent over the wire after alt setting 0 has been selected. The
>> chipset doesn't like these at and bails out with protocol errors. Fixing
>> this involves some rework of the logic. The patch is unfortunately a
>> little big, but I see no option than getting it merged for 3.6.
> 
> The issue seems to be fixed for me. Let's hope that it'll make it in
> the next v3.5-rc.

Thanks for testing. I just sent two patches. Combined, they are
identical to what you tested. Anyone else wants to add a Tested-by?

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-07-12 13:27 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CADYPuQ75GAxGyZgiUwygvnQMmDcL9+NMHNo432kg1RYC7vbfQA@mail.gmail.com>
2012-07-02 12:10 ` Regression in sound/usb/ Daniel Mack
     [not found]   ` <CADYPuQ5RFJAaFDpT+4XM-JDWzDO5czVAU3A++_HVHjhN=VBhvQ@mail.gmail.com>
2012-07-03  8:00     ` Takashi Iwai
     [not found]       ` <CADYPuQ4Uj8pq9nZOJemY9kZtSrG-WfG4s90b+a00_KteJXU_Sg@mail.gmail.com>
2012-07-03  8:27         ` Takashi Iwai
     [not found]           ` <CADYPuQ6DT4=NW2tzCLrKYnUHQ6p5qONZjY8PeKq-Z4HAk68tpw@mail.gmail.com>
2012-07-03  9:01             ` Takashi Iwai
2012-07-05 14:41               ` Takashi Iwai
     [not found]                 ` <CADYPuQ7yWpnPSvoVQDV+EyJfC39MDxhP9r5Jiqk_Jh8g65Xd4g@mail.gmail.com>
2012-07-05 15:36                   ` Takashi Iwai
2012-07-10 21:14                     ` Daniel Mack
     [not found]                       ` <CADYPuQ6XRSAxKvctCr3FrJ71smk-xOEMF_5VAv-6F5gdM7dwuQ@mail.gmail.com>
2012-07-11  8:31                         ` Daniel Mack
     [not found]                           ` <4FFD9B29.1020403@canonical.com>
2012-07-11 15:28                             ` Daniel Mack
2012-07-11 23:10                         ` Daniel Mack
2012-07-11 23:41                           ` Daniel Mack
     [not found]                           ` <CADYPuQ5sE28JRXLaBUYzjqvuJyWY9cWUCM4mYFByYQUXppDOQA@mail.gmail.com>
2012-07-12 13:20                             ` Daniel Mack
2012-07-05 15:57                   ` Daniel Mack

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.