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,13 +431,15 @@ got_one:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* issue bulk transfer */
|
/* issue bulk transfer */
|
||||||
DPRINTF_DEBUG((MY_ID "queueing bulk xfer IN endpoint\n"));
|
if (midiDevice->ept_in != NULL) {
|
||||||
status = usb->queue_bulk(midiDevice->ept_in->handle, midiDevice->buffer,
|
DPRINTF_DEBUG((MY_ID "queueing bulk xfer IN endpoint\n"));
|
||||||
midiDevice->inMaxPkt,
|
status = usb->queue_bulk(midiDevice->ept_in->handle, midiDevice->buffer,
|
||||||
(usb_callback_func)midi_usb_read_callback, midiDevice);
|
midiDevice->inMaxPkt,
|
||||||
if (status != B_OK) {
|
(usb_callback_func)midi_usb_read_callback, midiDevice);
|
||||||
DPRINTF_ERR((MY_ID "queue_bulk() error 0x%" B_PRIx32 "\n", status));
|
if (status != B_OK) {
|
||||||
return B_ERROR;
|
DPRINTF_ERR((MY_ID "queue_bulk() error 0x%" B_PRIx32 "\n", status));
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*cookie = midiDevice;
|
*cookie = midiDevice;
|
||||||
@@ -471,8 +473,11 @@ usb_midi_removed(void* cookie)
|
|||||||
}
|
}
|
||||||
remove_port(port);
|
remove_port(port);
|
||||||
}
|
}
|
||||||
usb->cancel_queued_transfers(midiDevice->ept_in->handle);
|
|
||||||
usb->cancel_queued_transfers(midiDevice->ept_out->handle);
|
if (midiDevice->ept_in != NULL)
|
||||||
|
usb->cancel_queued_transfers(midiDevice->ept_in->handle);
|
||||||
|
if (midiDevice->ept_out != NULL)
|
||||||
|
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));
|
||||||
remove_device(midiDevice);
|
remove_device(midiDevice);
|
||||||
|
|||||||
Reference in New Issue
Block a user