aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2016-08-12 08:03:31 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2016-08-12 08:03:31 +0000
commit8c1a8a7b98dc13662c490a782805ef2a49bda66b (patch)
tree0fb7b835f0bfb9dc06c19e0d06661ddc417823ca
parentde6e36c8d6967cb02d18f1d3e73fa82e87bcd6a8 (diff)
downloadsrc-8c1a8a7b98dc13662c490a782805ef2a49bda66b.tar.gz
src-8c1a8a7b98dc13662c490a782805ef2a49bda66b.zip
MFC r301039:
Add support for simplex USB MIDI devices, which only provide BULK or INTERRUPT endpoints for moving data in one direction, like the KeyRig 49 from M-Audio. Requested by: Ivan Klymenko <fidaj@ukr.net>
Notes
Notes: svn path=/stable/8/; revision=303995
-rw-r--r--sys/dev/sound/usb/uaudio.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 19e3dc6e0eaf..c55740311e18 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -660,6 +660,7 @@ static const struct usb_config
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
.bufsize = UMIDI_TX_BUFFER,
+ .flags = {.no_pipe_ok = 1},
.callback = &umidi_bulk_write_callback,
},
@@ -668,7 +669,7 @@ static const struct usb_config
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.bufsize = 4, /* bytes */
- .flags = {.short_xfer_ok = 1,.proxy_buffer = 1,},
+ .flags = {.short_xfer_ok = 1,.proxy_buffer = 1,.no_pipe_ok = 1},
.callback = &umidi_bulk_read_callback,
},
};
@@ -5747,7 +5748,16 @@ umidi_start_write(struct usb_fifo *fifo)
{
struct umidi_chan *chan = usb_fifo_softc(fifo);
- usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]);
+ if (chan->xfer[UMIDI_TX_TRANSFER] == NULL) {
+ uint8_t buf[1];
+ int actlen;
+ do {
+ /* dump data */
+ usb_fifo_get_data_linear(fifo, buf, 1, &actlen, 0);
+ } while (actlen > 0);
+ } else {
+ usbd_transfer_start(chan->xfer[UMIDI_TX_TRANSFER]);
+ }
}
static void
@@ -5865,6 +5875,11 @@ umidi_probe(device_t dev)
DPRINTF("error=%s\n", usbd_errstr(error));
goto detach;
}
+ if (chan->xfer[UMIDI_TX_TRANSFER] == NULL &&
+ chan->xfer[UMIDI_RX_TRANSFER] == NULL) {
+ DPRINTF("no BULK or INTERRUPT MIDI endpoint(s) found\n");
+ goto detach;
+ }
/*
* Some USB MIDI device makers couldn't resist using
@@ -5878,7 +5893,8 @@ umidi_probe(device_t dev)
* and 64-byte maximum packet sizes for full-speed bulk
* endpoints and 512 bytes for high-speed bulk endpoints."
*/
- if (usbd_xfer_maxp_was_clamped(chan->xfer[UMIDI_TX_TRANSFER]))
+ if (chan->xfer[UMIDI_TX_TRANSFER] != NULL &&
+ usbd_xfer_maxp_was_clamped(chan->xfer[UMIDI_TX_TRANSFER]))
chan->single_command = 1;
if (chan->single_command != 0)