[alsa-devel] How to add a new MIDI device to the usbaudio driver

Kristian Amlie kristian at amlie.name
Tue Aug 23 13:57:14 CEST 2011


On 08/23/11 12:16, Daniel Mack wrote:
> On Tue, Aug 23, 2011 at 12:07 PM, Kristian Amlie <kristian at amlie.name> wrote:
>> On 08/23/11 11:38, Clemens Ladisch wrote:
>>> Kristian Amlie wrote:
>>>>   idVendor           0x0403 Future Technology Devices International, Ltd
>>>>   idProduct          0xb8d8
>>>
>>> There is a kernel driver for this chipset; try
>>> "modprobe ftdi_sio product=0xb8d8".  This will give you a serial port
>>> which you can try to configure for the correct baud rate and see whether
>>> MIDI bytes come out.  (There is currently no mechanism to make a MIDI
>>> device from such a serial port; this would require extending or creating
>>> a driver.)
>>
>> Forgive me, I'm not very well acquainted with how serial drivers work in
>> Linux. The driver did give me a new device, so here is what I tried:
>>
>> $ setserial /dev/ttyUSB0 spd_normal uart 16550A
>> $ cat /dev/ttyUSB0 > dump
>>
>> I was not able to get any output from the serial device, however, while
>> cat was running and I was pressing buttons on the instrument, it
>> spontaneously changed program on me (MIDI program change), so
>> *something* goes across the wire.
> 
> Try "cu" (provided in the package "uucp" on some distributions), and
> see if you can make the hardware operate on 31250 Baud, which is the
> nominal rate for MIDI. If you can, you should be able to receive a raw
> MIDI byte stream. But as I say, I think that requires a special
> divider setup that is not supported by the ftdi_sio driver.

I was not able to to use 31250 baud as you suggested. However, I tried
38400 baud, and that seemed to work. I got a small number of bytes
everytime I pressed a key on the instrument.

Using the following command line:

$ cu -s 38400 -l /dev/ttyUSB0 | hexdump -C

and pressing the same key repeatedly with the same force, I got the
following output:

00000000  18 f9 ff 18 03 f8 18 f9  ff 18 01 f8 18 f9 ff 18
|................|
00000010  01 f8 18 fb ff 18 01 f8  18 fb ff 18 01 f8 18 fb
|................|
00000020  ff 18 03 f8 18 f9 ff 18  01 f8 18 fb ff 18 01 f8
|................|
00000030  18 fb ff 18 01 f8 18 fb  ff 18 01 f8 07 43 6f 6e
|.............Con|
00000040  6e 65 63 74 65 64 2e 0a  07 43 6f 6e 6e 65 63 74
|nected...Connect|
00000050  65 64 2e 0a 0a 07 44 69  73 63 6f 6e 6e 65 63 74
|ed....Disconnect|
00000060  65 64 2e 0a                                       |ed..|
00000064

-- 
Kristian


More information about the Alsa-devel mailing list