ALSA: usb-audio: dynamic detection of MIDI interfaces in uaxx-quirk
authorPedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
Tue, 7 Oct 2008 18:54:18 +0000 (20:54 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 10 Oct 2008 11:41:57 +0000 (13:41 +0200)
The MIDI interfaces have to be detected dynamically for Edirol devices
ua-700, ua-25 and ua4-fx. This patch reverses the wrong changes made by
my other patch in uaxx-quirk.

Signed-off-by: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
sound/usb/usbaudio.c
sound/usb/usbquirks.h

index 6e70ba4..bbd70d5 100644 (file)
@@ -3023,6 +3023,31 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
        alts = &iface->altsetting[1];
        altsd = get_iface_desc(alts);
 
+       if (altsd->bNumEndpoints == 2) {
+               static const struct snd_usb_midi_endpoint_info ua700_ep = {
+                       .out_cables = 0x0003,
+                       .in_cables  = 0x0003
+               };
+               static const struct snd_usb_audio_quirk ua700_quirk = {
+                       .type = QUIRK_MIDI_FIXED_ENDPOINT,
+                       .data = &ua700_ep
+               };
+               static const struct snd_usb_midi_endpoint_info uaxx_ep = {
+                       .out_cables = 0x0001,
+                       .in_cables  = 0x0001
+               };
+               static const struct snd_usb_audio_quirk uaxx_quirk = {
+                       .type = QUIRK_MIDI_FIXED_ENDPOINT,
+                       .data = &uaxx_ep
+               };
+               if (chip->usb_id == USB_ID(0x0582, 0x002b))
+                       return snd_usb_create_midi_interface(chip, iface,
+                                                            &ua700_quirk);
+               else
+                       return snd_usb_create_midi_interface(chip, iface,
+                                                            &uaxx_quirk);
+       }
+
        if (altsd->bNumEndpoints != 1)
                return -ENXIO;
 
index 85532cf..69689e7 100644 (file)
@@ -870,11 +870,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
                        },
                        {
                                .ifnum = 3,
-                               .type = QUIRK_MIDI_FIXED_ENDPOINT,
-                               .data = & (const struct snd_usb_midi_endpoint_info) {
-                                       .out_cables = 0x0003,
-                                       .in_cables  = 0x0003
-                               }
+                               .type = QUIRK_AUDIO_EDIROL_UAXX
                        },
                        {
                                .ifnum = -1
@@ -1216,11 +1212,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
                        },
                        {
                                .ifnum = 2,
-                               .type = QUIRK_MIDI_FIXED_ENDPOINT,
-                               .data = & (const struct snd_usb_midi_endpoint_info) {
-                                       .out_cables = 0x0001,
-                                       .in_cables  = 0x0001
-                               }
+                               .type = QUIRK_AUDIO_EDIROL_UAXX
                        },
                        {
                                .ifnum = -1
@@ -1375,11 +1367,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
                        },
                        {
                                .ifnum = 2,
-                               .type = QUIRK_MIDI_FIXED_ENDPOINT,
-                               .data = & (const struct snd_usb_midi_endpoint_info) {
-                                       .out_cables = 0x0001,
-                                       .in_cables  = 0x0001
-                               }
+                               .type = QUIRK_AUDIO_EDIROL_UAXX
                        },
                        {
                                .ifnum = -1