diff options
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/usbaudio.c | 24 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 77 |
2 files changed, 45 insertions, 56 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 2ead878bcb8f..ea1b1f87c1b6 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2755,9 +2755,9 @@ static int create_fixed_stream_quirk(snd_usb_audio_t *chip, | |||
2755 | /* | 2755 | /* |
2756 | * create a stream for an interface with proper descriptors | 2756 | * create a stream for an interface with proper descriptors |
2757 | */ | 2757 | */ |
2758 | static int create_standard_interface_quirk(snd_usb_audio_t *chip, | 2758 | static int create_standard_audio_quirk(snd_usb_audio_t *chip, |
2759 | struct usb_interface *iface, | 2759 | struct usb_interface *iface, |
2760 | const snd_usb_audio_quirk_t *quirk) | 2760 | const snd_usb_audio_quirk_t *quirk) |
2761 | { | 2761 | { |
2762 | struct usb_host_interface *alts; | 2762 | struct usb_host_interface *alts; |
2763 | struct usb_interface_descriptor *altsd; | 2763 | struct usb_interface_descriptor *altsd; |
@@ -2765,24 +2765,14 @@ static int create_standard_interface_quirk(snd_usb_audio_t *chip, | |||
2765 | 2765 | ||
2766 | alts = &iface->altsetting[0]; | 2766 | alts = &iface->altsetting[0]; |
2767 | altsd = get_iface_desc(alts); | 2767 | altsd = get_iface_desc(alts); |
2768 | switch (quirk->type) { | 2768 | err = parse_audio_endpoints(chip, altsd->bInterfaceNumber); |
2769 | case QUIRK_AUDIO_STANDARD_INTERFACE: | ||
2770 | err = parse_audio_endpoints(chip, altsd->bInterfaceNumber); | ||
2771 | if (!err) | ||
2772 | usb_set_interface(chip->dev, altsd->bInterfaceNumber, 0); /* reset the current interface */ | ||
2773 | break; | ||
2774 | case QUIRK_MIDI_STANDARD_INTERFACE: | ||
2775 | err = snd_usb_create_midi_interface(chip, iface, NULL); | ||
2776 | break; | ||
2777 | default: | ||
2778 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); | ||
2779 | return -ENXIO; | ||
2780 | } | ||
2781 | if (err < 0) { | 2769 | if (err < 0) { |
2782 | snd_printk(KERN_ERR "cannot setup if %d: error %d\n", | 2770 | snd_printk(KERN_ERR "cannot setup if %d: error %d\n", |
2783 | altsd->bInterfaceNumber, err); | 2771 | altsd->bInterfaceNumber, err); |
2784 | return err; | 2772 | return err; |
2785 | } | 2773 | } |
2774 | /* reset the current interface */ | ||
2775 | usb_set_interface(chip->dev, altsd->bInterfaceNumber, 0); | ||
2786 | return 0; | 2776 | return 0; |
2787 | } | 2777 | } |
2788 | 2778 | ||
@@ -3044,7 +3034,7 @@ static int snd_usb_create_quirk(snd_usb_audio_t *chip, | |||
3044 | [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, | 3034 | [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, |
3045 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, | 3035 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, |
3046 | [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface, | 3036 | [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface, |
3047 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_interface_quirk, | 3037 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
3048 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, | 3038 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
3049 | [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, | 3039 | [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, |
3050 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, | 3040 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, |
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); |