Commit 51ab5d77 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: Properly match with audio interface class

There are a few entries in the quirk table that set the device ID with
USB_DEVICE() macro while having an extra bInterfaceClass field.  But
bInterfaceClass field is never checked unless the proper match_flags
is set, so those may match incorrectly with all interfaces.

Introduce another macro to match with the vid/pid pair and the audio
class interface, and apply it to such entries, so that they can match
properly.

Link: https://lore.kernel.org/r/20200817082140.20232-4-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fa10635f
...@@ -35,6 +35,14 @@ ...@@ -35,6 +35,14 @@
.bInterfaceClass = USB_CLASS_AUDIO, \ .bInterfaceClass = USB_CLASS_AUDIO, \
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
/* Another standard entry matching with vid/pid and the audio class */
#define USB_AUDIO_CLASS(vend, prod) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
USB_DEVICE_ID_MATCH_INT_CLASS, \
.idVendor = vend, \
.idProduct = prod, \
.bInterfaceClass = USB_CLASS_AUDIO
/* FTDI devices */ /* FTDI devices */
{ {
USB_DEVICE(0x0403, 0xb8d8), USB_DEVICE(0x0403, 0xb8d8),
...@@ -68,34 +76,14 @@ ...@@ -68,34 +76,14 @@
} }
}, },
{ /* E-Mu 0202 USB */
/* E-Mu 0202 USB */ { USB_AUDIO_CLASS(0x041e, 0x3f02) },
.match_flags = USB_DEVICE_ID_MATCH_DEVICE, /* E-Mu 0404 USB */
.idVendor = 0x041e, { USB_AUDIO_CLASS(0x041e, 0x3f04) },
.idProduct = 0x3f02, /* E-Mu Tracker Pre */
.bInterfaceClass = USB_CLASS_AUDIO, { USB_AUDIO_CLASS(0x041e, 0x3f0a) },
}, /* E-Mu 0204 USB */
{ { USB_AUDIO_CLASS(0x041e, 0x3f19) },
/* E-Mu 0404 USB */
.match_flags = USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x041e,
.idProduct = 0x3f04,
.bInterfaceClass = USB_CLASS_AUDIO,
},
{
/* E-Mu Tracker Pre */
.match_flags = USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x041e,
.idProduct = 0x3f0a,
.bInterfaceClass = USB_CLASS_AUDIO,
},
{
/* E-Mu 0204 USB */
.match_flags = USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x041e,
.idProduct = 0x3f19,
.bInterfaceClass = USB_CLASS_AUDIO,
},
/* /*
* HP Wireless Audio * HP Wireless Audio
...@@ -2751,10 +2739,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -2751,10 +2739,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
}, },
/* KeithMcMillen Stringport */ /* KeithMcMillen Stringport */
{ { USB_AUDIO_CLASS(0x1f38, 0x0001) },
USB_DEVICE(0x1f38, 0x0001),
.bInterfaceClass = USB_CLASS_AUDIO,
},
/* Miditech devices */ /* Miditech devices */
{ {
...@@ -2977,10 +2962,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), ...@@ -2977,10 +2962,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
}, },
{ {
/* Tascam US122 MKII - playback-only support */ /* Tascam US122 MKII - playback-only support */
.match_flags = USB_DEVICE_ID_MATCH_DEVICE, USB_AUDIO_CLASS(0x0644, 0x8021),
.idVendor = 0x0644,
.idProduct = 0x8021,
.bInterfaceClass = USB_CLASS_AUDIO,
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
.vendor_name = "TASCAM", .vendor_name = "TASCAM",
.product_name = "US122 MKII", .product_name = "US122 MKII",
...@@ -3612,3 +3594,4 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), ...@@ -3612,3 +3594,4 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
#undef USB_DEVICE_VENDOR_SPEC #undef USB_DEVICE_VENDOR_SPEC
#undef USB_AUDIO_DEVICE #undef USB_AUDIO_DEVICE
#undef USB_AUDIO_CLASS
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment