Subject: kern/23987: umidi locks up on second open for reading
To: None <firstname.lastname@example.org>
From: Andreas Gustafsson <email@example.com>
Date: 01/04/2004 21:47:49
>Synopsis: umidi locks up on second open for reading
>Arrival-Date: Mon Jan 05 05:48:00 UTC 2004
>Originator: Andreas Gustafsson
>Release: NetBSD 1.6ZG
System: NetBSD guava.araneus.fi 1.6ZG NetBSD 1.6ZG (GUAVAMP) #0: Sat Dec 20 14:10:47 PST 2003 firstname.lastname@example.org:/usr/src/sys/arch/i386/compile/GUAVAMP i386
In umidi.c, a USB bulk transfer is started to read data from the
adapter when the midi device is opened for reading (in open_in_jack()),
but the transfer is not aborted when the device is closed.
Hence, when the device is opened for a second time, will be two active
transfers, and badness ensues.
Build a kernel with the DIAGNOSTIC option.
Connect a USB midi adapter (I use an Edirol UM-1SX, but any supported
adapter should give the same results). Note the midi device number
printed in the attach message on the console. There is no need to
connect any MIDI devices to the adapter.
Run the following command *twice* (adjust the "1" as needed to match
the actual attached device number):
Notice that the a message like the following is printed on the console:
usb_insert_transfer: xfer=0xc0ccee00 not busy 0x4f4e5155
I don't think you need a DIAGNOSTIC kernel in this case.
Connect an USB adapter as above.
Connect a MIDI keyboard or other device sending MIDI events to the
MIDI IN port.
Run the following command (again, adjust the "1" as needed):
od -x </dev/rmidi1
Generate some MIDI events by playing on the keyboard (or equivalent),
and see that the events are displayed on the terminal in hex. Abort
the "od" with control-C and restart, twice. Notice that on the third
run, incoming MIDI events are no longer displayed.
I would fix this myself, but I'm not sure what the right way to abort
the transfer is, with the usbdi(9) man page being as incomplete as it