----- Original Message ----
From: Clemens Ladisch <cladisch@googlemail.com>
To: Alexander Saydakov <sandy_saydakov@yahoo.com>
Cc: alsa-user@lists.sourceforge.net
Sent: Friday, September 28, 2007 9:14:21 AM
Subject: Re: [Alsa-user] midi port does not work

>Alexander Saydakov wrote:
>> I am trying to hook up a MIDI keyboard. Here is my configuration:
>>
>> Asus P4P800-E motherboard with on-board sound and MIDI/game port.
>> MIDI port is configured 0x330 irq 5 in BIOS setup
>> ...
>> $ aseqdump -l
>>  Port    Client name                      Port name
>> ...
>>  20:0    MPU-401 UART                     MPU-401 UART MIDI
>>
>> $ aseqdump -p 20:0
>> Cannot connect from port 20:0 - Input/output error
>>
>> # tail /var/log/messages
>> ...mpu401_uart.c:263: cmd: 0x3f failed at 0x330 (status = 0x80, data = 0x90)

>This indicates that the driver was not able to switch the device into
>UART mode.  It's possible that there was some data on the MIDI port that
>prevented the driver from reading the port's status message; please try
>running aseqdump after rebooting, before pressing any key on the MIDI
>keyboard.

I have done this after a reboot (I wanted to check the motherboard type). And my keyboard was turned off at the moment.
 
Where is that switchinng code sitting? Can I put some debug trace there for you?