alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Kristian Amlie <kristian@amlie.name>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: alsa-devel@alsa-project.org, Daniel Mack <zonque@gmail.com>
Subject: Re: How to add a new MIDI device to the usbaudio driver
Date: Thu, 25 Aug 2011 13:28:33 +0200	[thread overview]
Message-ID: <4E5631E1.7050400@amlie.name> (raw)
In-Reply-To: <4E555646.2030209@ladisch.de>

Gentlemen, I believe we've got ourselves a new driver!

It turns out the problem I was having earlier where MIDI events didn't
arrive, was a pilot error (reloading the wrong module). With my latest
patch, both MIDI input and output works. I'll send it in a separate
email for review.

Thanks a lot to Daniel and Clemens! Your help was a invaluable!

One caveat I have discovered with the patch: If you keep the instrument
plugged in, but reload the driver, then the driver gets out of sync with
the MIDI messages and won't report any. This seems to be because, in the
stream, the message type is cached and subsequent messages do not report
what type of message they are unless they are switching to a new type
(going from control message to note message, for example). You can reset
the stream by manually generating MIDI messages of different types (turn
the volume knob while pressing a few notes), or eventually the
instrument will reset itself and send the type anyway. So it's not
critical, but would be nice to fix. I'm not sure how to solve it though...

On 08/24/11 21:51, Clemens Ladisch wrote:
>> +		/* 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;
> 
> The chip reads its initial configuration from the EEPROM, so these
> commands might not be necessary.

You're right, they're not.

>> +		/* set baud rate */
>> +		err = snd_usbmidi_ftdi_command(umidi, 3, 0xc04e);
> 
> Replace 0xc04e with 0x60 to get exactly 31250 baud.

That did the trick! Thanks!

> Furthermore, the FT232RL chip sends two modem status bytes in its
> packets, so we need something like this to prevent them from being
> interpreted as MIDI:

Done!

-- 
Kristian

  reply	other threads:[~2011-08-25 11:33 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
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 [this message]
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=4E5631E1.7050400@amlie.name \
    --to=kristian@amlie.name \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=zonque@gmail.com \
    /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).