diff options
author | hselasky <hselasky@FreeBSD.org> | 2011-07-03 13:27:23 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2011-07-03 13:27:23 +0000 |
commit | f91c2275efeb1baed247c1d77c1489b4df4010e0 (patch) | |
tree | 6ca05bd9a5fc3c5b0eef81794881c7b5bed3d340 | |
parent | 9cad5bfef3ce97c030d30e66deb6371458c2281b (diff) | |
download | FreeBSD-src-f91c2275efeb1baed247c1d77c1489b4df4010e0.zip FreeBSD-src-f91c2275efeb1baed247c1d77c1489b4df4010e0.tar.gz |
Introduce a quirk for broken USB MIDI hardware instead of limiting performance
in general.
MFC after: 1 week
-rw-r--r-- | sys/dev/sound/usb/uaudio.c | 22 | ||||
-rw-r--r-- | sys/dev/usb/quirk/usb_quirk.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/quirk/usb_quirk.h | 1 | ||||
-rw-r--r-- | sys/dev/usb/usbdevs | 4 |
4 files changed, 18 insertions, 11 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 59fc4f8..e5abfb5 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -192,7 +192,7 @@ struct uaudio_chan { }; #define UMIDI_CABLES_MAX 16 /* units */ -#define UMIDI_TX_FRAMES 64 /* units */ +#define UMIDI_TX_FRAMES 128 /* units */ #define UMIDI_TX_BUFFER (UMIDI_TX_FRAMES * 4) /* bytes */ enum { @@ -236,6 +236,7 @@ struct umidi_chan { uint8_t curr_cable; uint8_t max_cable; uint8_t valid; + uint8_t single_command; }; struct uaudio_softc { @@ -499,7 +500,6 @@ static const struct usb_config .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = UMIDI_TX_BUFFER, - .frames = UMIDI_TX_FRAMES, .callback = &umidi_bulk_write_callback, }, @@ -3565,6 +3565,7 @@ tr_setup: nframes = 0; /* reset */ start_cable = chan->curr_cable; tr_any = 0; + pc = usbd_xfer_get_frame(xfer, 0); while (1) { @@ -3592,15 +3593,11 @@ tr_setup: sub->temp_cmd[0], sub->temp_cmd[1], sub->temp_cmd[2], sub->temp_cmd[3]); - usbd_xfer_set_frame_offset(xfer, 4 * nframes, nframes); - usbd_xfer_set_frame_len(xfer, nframes, 4); - - pc = usbd_xfer_get_frame(xfer, nframes); - - usbd_copy_in(pc, 0, sub->temp_cmd, 4); + usbd_copy_in(pc, nframes * 4, sub->temp_cmd, 4); nframes++; - if (nframes >= UMIDI_TX_FRAMES) + + if ((nframes >= UMIDI_TX_FRAMES) || (chan->single_command != 0)) break; } else { continue; @@ -3618,9 +3615,9 @@ tr_setup: } } - if (nframes > 0) { + if (nframes != 0) { DPRINTF("Transferring %d frames\n", (int)nframes); - usbd_xfer_set_frames(xfer, nframes); + usbd_xfer_set_frame_len(xfer, 0, 4 * nframes); usbd_transfer_submit(xfer); } break; @@ -3792,6 +3789,9 @@ umidi_probe(device_t dev) int error; uint32_t n; + if (usb_test_quirk(uaa, UQ_SINGLE_CMD_MIDI)) + chan->single_command = 1; + if (usbd_set_alt_interface_index(sc->sc_udev, chan->iface_index, chan->iface_alt_index)) { DPRINTF("setting of alternate index failed!\n"); diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index 0c3d673..e54b908 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -472,6 +472,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(ROLAND, SD20, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), USB_QUIRK(ROLAND, SD80, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), USB_QUIRK(ROLAND, UA700, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(MEDELI, DD305, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI, UQ_MATCH_VENDOR_ONLY), }; #undef USB_QUIRK_VP #undef USB_QUIRK @@ -538,6 +539,7 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = { [UQ_MSC_EJECT_TCT] = "UQ_MSC_EJECT_TCT", [UQ_BAD_MIDI] = "UQ_BAD_MIDI", [UQ_AU_VENDOR_CLASS] = "UQ_AU_VENDOR_CLASS", + [UQ_SINGLE_CMD_MIDI] = "UQ_SINGLE_CMD_MIDI", }; /*------------------------------------------------------------------------* diff --git a/sys/dev/usb/quirk/usb_quirk.h b/sys/dev/usb/quirk/usb_quirk.h index e86794e..e012842 100644 --- a/sys/dev/usb/quirk/usb_quirk.h +++ b/sys/dev/usb/quirk/usb_quirk.h @@ -102,6 +102,7 @@ enum { UQ_BAD_MIDI, /* device claims MIDI class, but isn't */ UQ_AU_VENDOR_CLASS, /* audio device uses vendor and not audio class */ + UQ_SINGLE_CMD_MIDI, /* at most one command per USB packet */ USB_QUIRK_MAX }; diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index a5f4cbb..aed83e1 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -484,6 +484,7 @@ vendor SHANTOU 0x0a46 ShanTou vendor MEDIAGEAR 0x0a48 MediaGear vendor BROADCOM 0x0a5c Broadcom vendor GREENHOUSE 0x0a6b GREENHOUSE +vendor MEDELI 0x0a67 Medeli vendor GEOCAST 0x0a79 Geocast Network Systems vendor IDQUANTIQUE 0x0aba id Quantique vendor ZYDAS 0x0ace Zydas Technology Corporation @@ -2130,6 +2131,9 @@ product MCT DU_H3SP_USB232 0x0200 D-Link DU-H3SP USB BAY Hub product MCT USB232 0x0210 USB-232 Interface product MCT SITECOM_USB232 0x0230 Sitecom USB-232 Products +/* Medeli */ +product MEDELI DD305 0x5011 DD305 Digital Drum Set + /* MediaTek, Inc. */ product MEDIATEK MTK3329 0x3329 MTK II GPS Receiver |