usb_midi: KDL when receiving data on a closed port
In normal situations the midi_server opens all midi ports, so this wouldn't be a problem. However, my new MIDI keyboard (Miditech i²Control-25) sends some MIDI events immediately when it is connected to an USB port. These would be handled before the MIDI server had a chance to open the port, leading to a KDL. A similar problem could be triggered by killing the midi_server then sending MIDI events from any other USB device.
This commit is contained in:
@@ -213,6 +213,9 @@ interpret_midi_buffer(usbmidi_device_info* midiDevice)
|
|||||||
if (port == NULL) {
|
if (port == NULL) {
|
||||||
DPRINTF_ERR((MY_ID "no port matching cable number %d!\n",
|
DPRINTF_ERR((MY_ID "no port matching cable number %d!\n",
|
||||||
packet->cn));
|
packet->cn));
|
||||||
|
} else if (port->open_fd == NULL) {
|
||||||
|
DPRINTF_ERR((MY_ID "received data for port %d but it is closed!\n",
|
||||||
|
packet->cn));
|
||||||
} else {
|
} else {
|
||||||
ring_buffer_write(port->rbuf, packet->midi, pktlen);
|
ring_buffer_write(port->rbuf, packet->midi, pktlen);
|
||||||
release_sem_etc(port->open_fd->sem_cb, pktlen,
|
release_sem_etc(port->open_fd->sem_cb, pktlen,
|
||||||
|
|||||||
Reference in New Issue
Block a user