All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <zonque@gmail.com>
To: Kristian Amlie <kristian@amlie.name>
Cc: alsa-devel@alsa-project.org, Clemens Ladisch <clemens@ladisch.de>
Subject: Re: How to add a new MIDI device to the usbaudio driver
Date: Tue, 23 Aug 2011 15:44:44 +0200	[thread overview]
Message-ID: <CACTFLANav3woJuXjdpsYEqvvbbTb53S0d2MtVoq9EByv-j-cxw@mail.gmail.com> (raw)
In-Reply-To: <4E53AAE4.2070303@amlie.name>

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

On Tue, Aug 23, 2011 at 3:28 PM, Kristian Amlie <kristian@amlie.name> wrote:
> On 08/23/11 15:16, Daniel Mack wrote:
>> On Tue, Aug 23, 2011 at 3:12 PM, Kristian Amlie <kristian@amlie.name> wrote:
>>> Here is the output from one complete run of cu, including connecting,
>>> pressing a key once on the instrument and killing cu afterwards:
>> ...
>> And now once again without killing cu, please. I'm interested in the
>> last commands that occur before the device starts working.
>
> Here you go:
>
> [21535.096008] change_speed(): urb_value: 16696, urb_index: 0
> [21535.097918] update_mctrl(): urb_value: 771, priv->interface: 0
> [21535.099917] change_speed(): urb_value: 49230, urb_index: 0
> [21535.103055] change_speed(): urb_value: 49230, urb_index: 0
> [21535.106037] change_speed(): urb_value: 49230, urb_index: 0

Ok, then let's try the attached patch. In case it doesn't work, you
might need to check whether there are any more ctrl requests sent by
the fdti_sio driver that need to be added to the MIDI driver as well.


Daniel

[-- Attachment #2: starr-labs-midi.diff --]
[-- Type: text/x-patch, Size: 2160 bytes --]

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index f928910..2c40873 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -2073,6 +2073,13 @@ void snd_usbmidi_input_start(struct list_head* p)
 		snd_usbmidi_input_start_ep(umidi->endpoints[i].in);
 }
 
+static int snd_usbmidi_ftdi_command(struct snd_usb_midi *umidi,
+				    u8 command, u16 value)
+{
+	return usb_control_msg(umidi->dev, usb_sndctrlpipe(umidi->dev, 0),
+				command, 0x40, value, 0, NULL, 0, 1000);
+}
+
 /*
  * Creates and registers everything needed for a MIDI streaming interface.
  */
@@ -2163,6 +2170,24 @@ int snd_usbmidi_create(struct snd_card *card,
 		/* endpoint 1 is input-only */
 		endpoints[1].out_cables = 0;
 		break;
+	case QUIRK_MIDI_FTDI:
+		/* reset the port */
+		err = snd_usbmidi_ftdi_command(umidi, 0, 0);
+		if (err < 0)
+			break;
+
+		/* set mctrl */
+		err = snd_usbmidi_ftdi_command(umidi, 1, 0x303);
+		if (err < 0)
+			break;
+
+		/* set baud rate */
+		err = snd_usbmidi_ftdi_command(umidi, 3, 0xc04e);
+		if (err < 0)
+			break;
+
+		err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
+		break;
 	default:
 		snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
 		err = -ENXIO;
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index a42e3ef..6c223e8 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -39,6 +39,16 @@
 	.idProduct = prod, \
 	.bInterfaceClass = USB_CLASS_VENDOR_SPEC
 
+/* Starr Labs MIDI USB device */
+{
+	USB_DEVICE(0x0403, 0xb8d8),
+	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+		/* .vendor_name = "STARR LABS", */
+		/* .product_name = "Starr Labs MIDI USB device", */
+		.ifnum = 0,
+		.type = QUIRK_MIDI_FTDI
+	}
+},
 /* Creative/Toshiba Multimedia Center SB-0500 */
 {
 	USB_DEVICE(0x041e, 0x3048),
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 1e79986..3e2b035 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -80,6 +80,7 @@ enum quirk_type {
 	QUIRK_MIDI_CME,
 	QUIRK_MIDI_AKAI,
 	QUIRK_MIDI_US122L,
+	QUIRK_MIDI_FTDI,
 	QUIRK_AUDIO_STANDARD_INTERFACE,
 	QUIRK_AUDIO_FIXED_ENDPOINT,
 	QUIRK_AUDIO_EDIROL_UAXX,

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



  reply	other threads:[~2011-08-23 13:44 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 10:52 How to add a new MIDI device to the usbaudio driver Kristian Amlie
2011-08-22 10:54 ` Daniel Mack
2011-08-22 11:40   ` Kristian Amlie
2011-08-22 11:49     ` Daniel Mack
2011-08-23  7:35       ` Kristian Amlie
2011-08-23  8:43         ` Daniel Mack
2011-08-23  9:03           ` Paul Menzel
2011-08-23  9:22             ` Daniel Mack
2011-08-23  9:42               ` Kristian Amlie
2011-08-23 10:02                 ` Paul Menzel
2011-08-27 10:38                   ` Kristian Amlie
2011-08-23  9:38     ` Clemens Ladisch
2011-08-23  9:42       ` Daniel Mack
2011-08-23 10:07       ` Kristian Amlie
2011-08-23 10:16         ` Daniel Mack
2011-08-23 11:57           ` Kristian Amlie
2011-08-23 12:20             ` Daniel Mack
2011-08-23 13:12               ` Kristian Amlie
2011-08-23 13:16                 ` Daniel Mack
2011-08-23 13:28                   ` Kristian Amlie
2011-08-23 13:44                     ` Daniel Mack [this message]
2011-08-24  8:09                       ` Kristian Amlie
2011-08-24  8:32                         ` Daniel Mack
2011-08-24 10:14                           ` Kristian Amlie
2011-08-24 10:29                             ` Daniel Mack
2011-08-24 13:14                               ` Kristian Amlie
2011-08-24 13:18                                 ` Daniel Mack
2011-08-24 19:51                       ` Clemens Ladisch
2011-08-25 11:28                         ` Kristian Amlie
2011-08-25 11:35                           ` [PATCH] Added support for Starr Labs USB MIDI devices Kristian Amlie
2011-08-25 12:20                             ` Daniel Mack
2011-08-25 13:40                               ` Kristian Amlie
2011-08-26 11:24                                 ` Clemens Ladisch
2011-08-25 12:38                           ` How to add a new MIDI device to the usbaudio driver Daniel Mack
2011-08-24 11:44             ` Clemens Ladisch
2011-08-24 12:05               ` Daniel Mack
2011-08-24 13:19               ` Kristian Amlie
2011-08-24 16:01                 ` 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=CACTFLANav3woJuXjdpsYEqvvbbTb53S0d2MtVoq9EByv-j-cxw@mail.gmail.com \
    --to=zonque@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=kristian@amlie.name \
    /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 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.