From: Clemens Ladisch <clemens@ladisch.de>
To: David Fries <david@fries.net>
Cc: David Griffith <dgriffi@cs.csubak.edu>,
Andrew Morton <akpm@linux-foundation.org>,
Alan Stern <stern@rowland.harvard.edu>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: bad endpoint address, MOTU FastLane
Date: Mon, 25 May 2009 10:20:43 +0200 [thread overview]
Message-ID: <4A1A54DB.3090902@ladisch.de> (raw)
In-Reply-To: <20090524220756.GC4300@spacedout.fries.net>
David Fries wrote:
> On Tue, May 12, 2009 at 09:55:08AM +0200, Clemens Ladisch wrote:
> > The driver could call usb_set_interface() again for the first interface
> > so that the USB core takes notice of the first set of endpoints again.
> > Please try the patch below.
> >
> > I guess I'll have to write another quirk for this.
>
> Adding usb_set_interface lets the device work again, ...
>
> The MOTU Fastlane device is the only one using QUIRK_MIDI_RAW. How about
> changing the name to QUIRK_MIDI_FASTLANE to imply it isn't completely
> generic anymore and adding a comment?
And while we're at it, the driver should claim interface 1 to prevent
anyone else from using it.
New patch below.
Are you okay with the tested-by tag?
===========
sound: usb-audio: make the MotU Fastlane work again
Kernel 2.6.18 broke the MotU Fastlane, which uses duplicate endpoint
numbers in a manner that is not only illegal but also confuses the
kernel's endpoint descriptor caching mechanism. To work around this, we
have to add a separate usb_set_interface() call to guide the USB core to
the correct descriptors.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Reported-and-tested-by: David Fries <david@fries.net>
--- linux/sound/usb/usbaudio.h
+++ linux/sound/usb/usbaudio.h
@@ -153,7 +153,7 @@ enum quirk_type {
QUIRK_MIDI_YAMAHA,
QUIRK_MIDI_MIDIMAN,
QUIRK_MIDI_NOVATION,
- QUIRK_MIDI_RAW,
+ QUIRK_MIDI_FASTLANE,
QUIRK_MIDI_EMAGIC,
QUIRK_MIDI_CME,
QUIRK_MIDI_US122L,
--- linux/sound/usb/usbquirks.h
+++ linux/sound/usb/usbquirks.h
@@ -1868,11 +1868,11 @@ YAMAHA_DEVICE(0x7010, "UB99"),
.data = & (const struct snd_usb_audio_quirk[]) {
{
.ifnum = 0,
- .type = QUIRK_MIDI_RAW
+ .type = QUIRK_MIDI_FASTLANE
},
{
.ifnum = 1,
- .type = QUIRK_IGNORE_INTERFACE
+ .type = QUIRK_MIDI_FASTLANE
},
{
.ifnum = -1
--- linux/sound/usb/usbaudio.c
+++ linux/sound/usb/usbaudio.c
@@ -3359,7 +3359,7 @@ static int snd_usb_create_quirk(struct s
[QUIRK_MIDI_YAMAHA] = snd_usb_create_midi_interface,
[QUIRK_MIDI_MIDIMAN] = snd_usb_create_midi_interface,
[QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface,
- [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface,
+ [QUIRK_MIDI_FASTLANE] = snd_usb_create_midi_interface,
[QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface,
[QUIRK_MIDI_CME] = snd_usb_create_midi_interface,
[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
--- linux/sound/usb/usbmidi.c
+++ linux/sound/usb/usbmidi.c
@@ -1573,6 +1573,33 @@ static int snd_usbmidi_detect_yamaha(str
}
/*
+ * Detects the endpoints and ports of the MotU Fastlane, and handles the
+ * interfaces' configuration.
+ */
+static int snd_usbmidi_detect_fastlane(struct snd_usb_midi *umidi,
+ struct snd_usb_midi_endpoint_info *eps)
+{
+ switch (get_iface_desc(umidi->iface->altsetting)->bInterfaceNumber) {
+ case 0:
+ /*
+ * Interface 1 contains isochronous endpoints, but with the same
+ * numbers as in interface 0. Since it is interface 1 that the
+ * USB core has most recently seen, these descriptors are now
+ * associated with the endpoint numbers. This will foul up our
+ * attempts to submit bulk/interrupt URBs to the endpoints in
+ * interface 0, so we have to make sure that the USB core looks
+ * again at interface 0 by calling usb_set_interface() on it.
+ */
+ usb_set_interface(umidi->chip->dev, 0, 0);
+ return snd_usbmidi_detect_per_port_endpoints(umidi, eps);
+ case 1:
+ return 1; /* no MIDI device for this interface, just claim it */
+ default:
+ return -ENXIO;
+ }
+}
+
+/*
* Creates the endpoints and their ports for Midiman devices.
*/
static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
@@ -1778,9 +1805,13 @@ int snd_usb_create_midi_interface(struct
umidi->usb_protocol_ops = &snd_usbmidi_novation_ops;
err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
break;
- case QUIRK_MIDI_RAW:
+ case QUIRK_MIDI_FASTLANE:
umidi->usb_protocol_ops = &snd_usbmidi_raw_ops;
- err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
+ err = snd_usbmidi_detect_fastlane(umidi, endpoints);
+ if (err == 1) {
+ kfree(umidi);
+ return 0;
+ }
break;
case QUIRK_MIDI_EMAGIC:
umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops;
next prev parent reply other threads:[~2009-05-25 8:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-11 22:12 bad endpoint address, MOTU FastLane David Fries
2009-05-12 7:55 ` Clemens Ladisch
2009-05-12 14:08 ` Alan Stern
2009-05-12 15:22 ` Todd T. Fries
2009-05-12 15:44 ` Alan Stern
2009-05-24 22:07 ` David Fries
2009-05-25 8:20 ` Clemens Ladisch [this message]
2009-05-26 0:41 ` David Fries
2009-05-26 7:25 ` Clemens Ladisch
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=4A1A54DB.3090902@ladisch.de \
--to=clemens@ladisch.de \
--cc=akpm@linux-foundation.org \
--cc=david@fries.net \
--cc=dgriffi@cs.csubak.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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