usb_midi: fix KDL when there is no in or out endpoint
usb_midi devices can be input-only or output-only. We failed to check for this in some places leading to KDL on devices that are not bidirectional. Should fix #11810.
This commit is contained in:
@@ -431,6 +431,7 @@ got_one:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* issue bulk transfer */
|
/* issue bulk transfer */
|
||||||
|
if (midiDevice->ept_in != NULL) {
|
||||||
DPRINTF_DEBUG((MY_ID "queueing bulk xfer IN endpoint\n"));
|
DPRINTF_DEBUG((MY_ID "queueing bulk xfer IN endpoint\n"));
|
||||||
status = usb->queue_bulk(midiDevice->ept_in->handle, midiDevice->buffer,
|
status = usb->queue_bulk(midiDevice->ept_in->handle, midiDevice->buffer,
|
||||||
midiDevice->inMaxPkt,
|
midiDevice->inMaxPkt,
|
||||||
@@ -439,6 +440,7 @@ got_one:
|
|||||||
DPRINTF_ERR((MY_ID "queue_bulk() error 0x%" B_PRIx32 "\n", status));
|
DPRINTF_ERR((MY_ID "queue_bulk() error 0x%" B_PRIx32 "\n", status));
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*cookie = midiDevice;
|
*cookie = midiDevice;
|
||||||
DPRINTF_INFO((MY_ID "usb_midi_added: %s\n", midiDevice->name));
|
DPRINTF_INFO((MY_ID "usb_midi_added: %s\n", midiDevice->name));
|
||||||
@@ -471,7 +473,10 @@ usb_midi_removed(void* cookie)
|
|||||||
}
|
}
|
||||||
remove_port(port);
|
remove_port(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (midiDevice->ept_in != NULL)
|
||||||
usb->cancel_queued_transfers(midiDevice->ept_in->handle);
|
usb->cancel_queued_transfers(midiDevice->ept_in->handle);
|
||||||
|
if (midiDevice->ept_out != NULL)
|
||||||
usb->cancel_queued_transfers(midiDevice->ept_out->handle);
|
usb->cancel_queued_transfers(midiDevice->ept_out->handle);
|
||||||
DPRINTF_DEBUG((MY_ID "usb_midi_removed: doing remove: %s\n",
|
DPRINTF_DEBUG((MY_ID "usb_midi_removed: doing remove: %s\n",
|
||||||
midiDevice->name));
|
midiDevice->name));
|
||||||
|
|||||||
Reference in New Issue
Block a user