diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-09-14 02:36:03 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-11-04 07:15:49 -0500 |
commit | d1bda0455478a9e2a13381044e9bb80a17ec92d2 (patch) | |
tree | fcf79d93d1b7293dfd6472b58dddf6ec52b7914c /sound/usb/usbmidi.c | |
parent | 5747e54042c710272cefed74cc457531a01768c9 (diff) |
[ALSA] usb-audio: simplify MIDI quirk handling
Modules: USB generic driver
Simplify the handling of MIDI quirks by treating an interface without
quirks as a QUIRK_MIDI_STANDARD_INTERFACE.
This also fixes the bug where a MIDI_STANDARD quirk would not be
recognized.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/usb/usbmidi.c')
-rw-r--r-- | sound/usb/usbmidi.c | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index f1a2e2c2e02f..32be9f99c023 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -1550,46 +1550,45 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip, | |||
1550 | 1550 | ||
1551 | /* detect the endpoint(s) to use */ | 1551 | /* detect the endpoint(s) to use */ |
1552 | memset(endpoints, 0, sizeof(endpoints)); | 1552 | memset(endpoints, 0, sizeof(endpoints)); |
1553 | if (!quirk) { | 1553 | switch (quirk ? quirk->type : QUIRK_MIDI_STANDARD_INTERFACE) { |
1554 | case QUIRK_MIDI_STANDARD_INTERFACE: | ||
1554 | err = snd_usbmidi_get_ms_info(umidi, endpoints); | 1555 | err = snd_usbmidi_get_ms_info(umidi, endpoints); |
1555 | } else { | 1556 | break; |
1556 | switch (quirk->type) { | 1557 | case QUIRK_MIDI_FIXED_ENDPOINT: |
1557 | case QUIRK_MIDI_FIXED_ENDPOINT: | 1558 | memcpy(&endpoints[0], quirk->data, |
1558 | memcpy(&endpoints[0], quirk->data, | 1559 | sizeof(snd_usb_midi_endpoint_info_t)); |
1559 | sizeof(snd_usb_midi_endpoint_info_t)); | 1560 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); |
1560 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); | 1561 | break; |
1561 | break; | 1562 | case QUIRK_MIDI_YAMAHA: |
1562 | case QUIRK_MIDI_YAMAHA: | 1563 | err = snd_usbmidi_detect_yamaha(umidi, &endpoints[0]); |
1563 | err = snd_usbmidi_detect_yamaha(umidi, &endpoints[0]); | 1564 | break; |
1564 | break; | 1565 | case QUIRK_MIDI_MIDIMAN: |
1565 | case QUIRK_MIDI_MIDIMAN: | 1566 | umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; |
1566 | umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; | 1567 | memcpy(&endpoints[0], quirk->data, |
1567 | memcpy(&endpoints[0], quirk->data, | 1568 | sizeof(snd_usb_midi_endpoint_info_t)); |
1568 | sizeof(snd_usb_midi_endpoint_info_t)); | 1569 | err = 0; |
1569 | err = 0; | 1570 | break; |
1570 | break; | 1571 | case QUIRK_MIDI_NOVATION: |
1571 | case QUIRK_MIDI_NOVATION: | 1572 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; |
1572 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; | 1573 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1573 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1574 | break; |
1574 | break; | 1575 | case QUIRK_MIDI_RAW: |
1575 | case QUIRK_MIDI_RAW: | 1576 | umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; |
1576 | umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; | 1577 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1577 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1578 | break; |
1578 | break; | 1579 | case QUIRK_MIDI_EMAGIC: |
1579 | case QUIRK_MIDI_EMAGIC: | 1580 | umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops; |
1580 | umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops; | 1581 | memcpy(&endpoints[0], quirk->data, |
1581 | memcpy(&endpoints[0], quirk->data, | 1582 | sizeof(snd_usb_midi_endpoint_info_t)); |
1582 | sizeof(snd_usb_midi_endpoint_info_t)); | 1583 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); |
1583 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); | 1584 | break; |
1584 | break; | 1585 | case QUIRK_MIDI_MIDITECH: |
1585 | case QUIRK_MIDI_MIDITECH: | 1586 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1586 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1587 | break; |
1587 | break; | 1588 | default: |
1588 | default: | 1589 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); |
1589 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); | 1590 | err = -ENXIO; |
1590 | err = -ENXIO; | 1591 | break; |
1591 | break; | ||
1592 | } | ||
1593 | } | 1592 | } |
1594 | if (err < 0) { | 1593 | if (err < 0) { |
1595 | kfree(umidi); | 1594 | kfree(umidi); |