[alsa-devel] How to add a new MIDI device to the usbaudio driver
Kristian Amlie
kristian at amlie.name
Tue Aug 23 15:12:40 CEST 2011
On 08/23/11 14:20, Daniel Mack wrote:
> On Tue, Aug 23, 2011 at 1:57 PM, Kristian Amlie <kristian at amlie.name> wrote:
>> 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
>
> That hexdump reads as "Connected....Disconnected". Are you sure you
> get useful data from cu?
Quite sure. Those messages are just from cu (I assume), telling me that
I connected and disconnected (by killing it). If I run it without
piping, they appear before and after the bytestream as they should. I
don't really know why they appear at the end in that output; maybe a
buffering issue.
In either case, the important data is in the three first lines. That is
what appears while I'm pressing the keys.
> If you are certain about this, I would recommend you add some debug
> printk() into drivers/usb/serial/ftdi_sio.c and trace what values the
> functions change_speed() and update_mctrl() pass to usb_control_msg()
> when the device is connected and cu is started. Once we have this
> information, I can prepare a patch to add the control messages to the
> MIDI driver.
Alright, I guess it is the urb_value and urb_index values you are
interested in?
Here is the output from one complete run of cu, including connecting,
pressing a key once on the instrument and killing cu afterwards:
[20380.847492] change_speed(): urb_value: 16696, urb_index: 0
[20380.849364] update_mctrl(): urb_value: 771, priv->interface: 0
[20380.851360] change_speed(): urb_value: 49230, urb_index: 0
[20380.854412] change_speed(): urb_value: 49230, urb_index: 0
[20380.857361] change_speed(): urb_value: 49230, urb_index: 0
[20387.615704] change_speed(): urb_value: 16696, urb_index: 0
[20387.619557] update_mctrl(): urb_value: 768, priv->interface: 0
--
Kristian
More information about the Alsa-devel
mailing list