Date: Fri, 12 Aug 2016 07:57:28 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r303993 - stable/10/sys/dev/sound/usb Message-ID: <201608120757.u7C7vSKd025849@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Aug 12 07:57:27 2016 New Revision: 303993 URL: https://svnweb.freebsd.org/changeset/base/303993 Log: 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> Modified: stable/10/sys/dev/sound/usb/uaudio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/10/sys/dev/sound/usb/uaudio.c Fri Aug 12 07:57:03 2016 (r303992) +++ stable/10/sys/dev/sound/usb/uaudio.c Fri Aug 12 07:57:27 2016 (r303993) @@ -663,6 +663,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, }, @@ -671,7 +672,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, }, }; @@ -5760,7 +5761,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 @@ -5878,6 +5888,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 @@ -5891,7 +5906,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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608120757.u7C7vSKd025849>