Message ID | CA+FkkmZjMYZ_Vr5jr192ccMoYst0UBMTNVJ=tN-z-cBNCqnqOw@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
At Fri, 13 Feb 2015 19:35:19 +0000, Joe Turner wrote: > > Hi Folks, > > This is my first time doing anything kernel-related, so apologies in > advance for any faux-pas which are to follow. I hope this is at least > going to the correct place! > > Currently after setting the sample rate of USB devices the driver tries to > get the sample rate back from the device, to check that the two match up. > The Lifecam doesn't support getting the sample rate, and so this operation > times-out, and we continue regardless. > > Because the USB timeout is pretty long this causes issues with some apps, > which begin to doubt the ability of the device to produce audio before the > timeout is up and misbehave in various ways. See > https://www.google.co.uk/search?q=%22cannot+get+freq+at+ep+0x82%22 for a > range of reports relating to this issue. > > This patch adds a quirk so that rather than check the sample rate and > timeout, we don't bother checking at all. > > Hope this all looks okay. The workaround would be OK as long as it really works. But the patch needs to follow the standard coding style and resent in a formal way. Please read Documentation/SubmittingPatches. Try to run scripts/checkpatch.pl at least. thanks, Takashi
diff -uprN -X linux-3.18/Documentation/dontdiff linux-3.18/sound/usb/clock.c linux-3.18-devel/sound/usb/clock.c --- linux-3.18/sound/usb/clock.c 2014-12-07 22:21:05.000000000 +0000 +++ linux-3.18-devel/sound/usb/clock.c 2015-02-13 18:47:48.179363942 +0000 @@ -303,6 +303,12 @@ static int set_sample_rate_v1(struct snd return err; } + if (snd_usb_get_sample_rate_quirk(chip)) { + /* Don't check the sample rate for devices which we know don't + * support reading */ + return 0; + } + if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR, USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN, UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, diff -uprN -X linux-3.18/Documentation/dontdiff linux-3.18/sound/usb/quirks.c linux-3.18-devel/sound/usb/quirks.c --- linux-3.18/sound/usb/quirks.c 2014-12-07 22:21:05.000000000 +0000 +++ linux-3.18-devel/sound/usb/quirks.c 2015-02-13 18:54:52.262687929 +0000 @@ -1102,6 +1102,14 @@ void snd_usb_set_format_quirk(struct snd } } +int snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) { + /* MS Lifecam HD-5000 doesn't support reading the sample rate. */ + if (chip->usb_id == USB_ID(0x045E, 0x076D)) { + return 1; + } + return 0; +} + void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep) { /* diff -uprN -X linux-3.18/Documentation/dontdiff linux-3.18/sound/usb/quirks.h linux-3.18-devel/sound/usb/quirks.h --- linux-3.18/sound/usb/quirks.h 2014-12-07 22:21:05.000000000 +0000 +++ linux-3.18-devel/sound/usb/quirks.h 2015-02-13 18:49:24.029361830 +0000 @@ -21,6 +21,9 @@ int snd_usb_apply_boot_quirk(struct usb_ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, struct audioformat *fmt); + +int snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip); + int snd_usb_is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp);