[linux-audio-user] Midi data arrives, but gets stuck in ALSA's buffer

From: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@email-addr-hidden>
Date: Sat Oct 07 2006 - 22:30:53 EEST

On Friday, 6 October 2006 22:33, Jens Gulden wrote:
> Hello, very weird:
>
> cat /proc/asound/card2/midi0 ->
>
> MidiSport 2x2
>
> Output 0
>    Tx bytes     : 0
> Output 1
>    Tx bytes     : 0
> Input 0
>    Rx bytes     : 1186
>    Buffer size  : 4096
>    Avail        : 1186  <--- ### SHOULD BE 0, NOT ==RX BYTES! ###
>    Overruns     : 0
> Input 1
>    Rx bytes     : 0
>
> Instead of passing the data further to the connected timidity, it gets
> stuck in the receive-buffer. When 4096 is reached, overruns start to count
> up.
>
> Connections have been set up using qjackctl. vkeybd->timidity works fine.
>
> The system is Musix0.50b12, realtime-kernel 2.6.15.4, with manually added
> MidiSport2x2 firmware. However, I don't think this is a typical
> "My-MidiSport-does-not-run-on-Musix" problem, as the firmware successfully
> loads and the MidiSport gets recognized as available device in ALSA. Even
> the data seems to arrive well as shown by "Rx bytes" (number of bytes per
> note-event is correct). What is wrong?

Short answer: the firmware distributed with Musix. It looked like a problem
with the drivers, because the ALSA /proc interface reported that incoming
data was received, but the data wasn't good.

Most Midisport NxN devices need a firmware, that must be loaded in the device
on each power on, before using it. For devices where N <= 2, there is a free
(libre) firmware, GPL licensed, that can be used instead the propietary one.
The GPL firmware, written in C by Lars Doelle, can be compiled with the SDCC
compiler, and it is standards compliant (using it, the Midisport behaves as
described by the USB MIDI specification document).

Seems that Musix has distributed corrupted firmware files. Please don't use
them.

You can use the propietary firmware made by M-Audio (Midiman). It works well,
although not standard (and no sources are available). You can find it here:
http://sourceforge.net/projects/usb-midi-fw

CVS repository where you can find correct GPL firmware sources, and ready to
use .ihx images:
http://linux-hotplug.cvs.sourceforge.net/linux-hotplug/firmware/ezusb/midi/original/

The tarball distributed by NAGANO Daisuke with the OSS-like driver also
contains the correct firmwares:
http://homepage3.nifty.com/StudioBreeze/software/usbmidi-e.html

I've verified also the RPM distributed by Planet CCRMA, and it is OK.

Size and MD5 hash for correct firmwares:

$ ls -l *.ihx
-rw-r--r-- 1 pedro pedro 7620 Oct 7 20:19 ezusbmidi1x1.ihx
-rw-r--r-- 1 pedro pedro 10168 Oct 7 20:19 ezusbmidi2x2.ihx

$ md5sum *.ihx
4d78294c5fd4575cf52a297e5f2f1e53 ezusbmidi1x1.ihx
23427b43a718feea911970746af174e7 ezusbmidi2x2.ihx

Regards,
Pedro
Received on Sun Oct 8 00:15:03 2006

This archive was generated by hypermail 2.1.8 : Sun Oct 08 2006 - 00:15:03 EEST