aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbmidi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/usbmidi.c')
-rw-r--r--sound/usb/usbmidi.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index 99295f9b7691..2bb1834a8c22 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -407,6 +407,20 @@ static void snd_usbmidi_maudio_broken_running_status_input(
407} 407}
408 408
409/* 409/*
410 * CME protocol: like the standard protocol, but SysEx commands are sent as a
411 * single USB packet preceded by a 0x0F byte.
412 */
413static void snd_usbmidi_cme_input(struct snd_usb_midi_in_endpoint *ep,
414 uint8_t *buffer, int buffer_length)
415{
416 if (buffer_length < 2 || (buffer[0] & 0x0f) != 0x0f)
417 snd_usbmidi_standard_input(ep, buffer, buffer_length);
418 else
419 snd_usbmidi_input_data(ep, buffer[0] >> 4,
420 &buffer[1], buffer_length - 1);
421}
422
423/*
410 * Adds one USB MIDI packet to the output buffer. 424 * Adds one USB MIDI packet to the output buffer.
411 */ 425 */
412static void snd_usbmidi_output_standard_packet(struct urb* urb, uint8_t p0, 426static void snd_usbmidi_output_standard_packet(struct urb* urb, uint8_t p0,
@@ -572,6 +586,12 @@ static struct usb_protocol_ops snd_usbmidi_maudio_broken_running_status_ops = {
572 .output_packet = snd_usbmidi_output_standard_packet, 586 .output_packet = snd_usbmidi_output_standard_packet,
573}; 587};
574 588
589static struct usb_protocol_ops snd_usbmidi_cme_ops = {
590 .input = snd_usbmidi_cme_input,
591 .output = snd_usbmidi_standard_output,
592 .output_packet = snd_usbmidi_output_standard_packet,
593};
594
575/* 595/*
576 * Novation USB MIDI protocol: number of data bytes is in the first byte 596 * Novation USB MIDI protocol: number of data bytes is in the first byte
577 * (when receiving) (+1!) or in the second byte (when sending); data begins 597 * (when receiving) (+1!) or in the second byte (when sending); data begins
@@ -1690,6 +1710,7 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip,
1690 err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); 1710 err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1);
1691 break; 1711 break;
1692 case QUIRK_MIDI_CME: 1712 case QUIRK_MIDI_CME:
1713 umidi->usb_protocol_ops = &snd_usbmidi_cme_ops;
1693 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); 1714 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
1694 break; 1715 break;
1695 default: 1716 default: