Skip to contentSkip to conversation

ALSA: usb-audio: Add quirk for Focusrite Scarlett 18i6

PATCH In review Martin Schwenke (by way of Martin Schwenke <[email protected]>) 4 participants 6 messages Nov 10, 2012 – Dec 29, 2012 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Add quirk for Focusrite Scarlett 18i6

Probing this device currently fails in snd_usb_audio_probe() because the call to snd_usb_create_mixer() fails. This is due to unknown or non-standard interface descriptor subtypes in parse_audio_unit():

usbaudio: unit 51: unexpected type 0x09
snd-usb-audio: probe of 1-8:1.0 failed with error -5

Some people are working around this by recompiling usb-audio with the call to snd_usb_create_mixer() commented out. It would be nice to avoid that.

While the best idea would be to look into the mixer creation failure, a reasonable short-term solution is to use quirks to only probe the trouble-free interfaces. This allows audio and MIDI interfaces to be used without any obvious issues.

Interface 0 is the main one to ignore. It contains lots of control-fu, including the unexpected interface descriptor subtypes. Interface 5 is for firmware updates and I'm not sure how to get support for this. Interface 3 is some sort of control interface that I don't understand:

Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 9
bInCollection 1
baInterfaceNr( 0) 1

---
 sound/usb/quirks-table.h |   52

++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)

sound/usb/quirks-table.h +11 -0
index 88d8ceb..c9dde5f 100644
@@ -2882,6 +2882,58 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 
 {
 	/*
+	 * Focusrite Scarlett 18i6
+	 *
+	 * Avoid mixer creation, which otherwise fails because some of
+	 * the interface descriptor subtypes for interface 0 are
+	 * unknown.  That should be fixed or worked-around but this at
+	 * least allows the device to be used successfully with a DAW
+	 * and an external mixer.  See comments below about other
+	 * ignored interfaces.
+	 */
+	USB_DEVICE(0x1235, 0x8004),
+	.driver_info = (unsigned long) & (const struct

snd_usb_audio_quirk) {
+ .vendor_name = "Focusrite",
+ .product_name = "Scarlett 18i6",
+ .ifnum = QUIRK_ANY_INTERFACE,
+ .type = QUIRK_COMPOSITE,
+ .data = & (const struct snd_usb_audio_quirk[]) {
+ {
+ /* InterfaceSubClass 1 (Control
Device) */
+ .ifnum = 0,
+ .type = QUIRK_IGNORE_INTERFACE
+ },
+ {
+ .ifnum = 1,
+ .type = QUIRK_AUDIO_STANDARD_INTERFACE
+ },
+ {
+ .ifnum = 2,
+ .type = QUIRK_AUDIO_STANDARD_INTERFACE
+ },
+ {
+ /* InterfaceSubClass 1 (Control
Device) */
+ .ifnum = 3,
+ .type = QUIRK_IGNORE_INTERFACE
+ },
+ {
+ .ifnum = 4,
+ .type = QUIRK_MIDI_STANDARD_INTERFACE
+ },
+ {
+ /* InterfaceSubClass 1 (Device
Firmware Update) */
+ .ifnum = 5,
+ .type = QUIRK_IGNORE_INTERFACE
+ },
+ {
+ .ifnum = -1
+ }
+ }
+ }
+},
+
+{
+ /*
* Some USB MIDI devices don't have an audio control interface,
* so we have to grab MIDI streaming interfaces here. */

Signature · 1 line
1.7.10.4
#1 lore raw

At Fri, 9 Nov 2012 20:20:23 +1100,

Quoted 42 lines · Martin Schwenke

Probing this device currently fails in snd_usb_audio_probe() because the call to snd_usb_create_mixer() fails. This is due to unknown or non-standard interface descriptor subtypes in parse_audio_unit():

usbaudio: unit 51: unexpected type 0x09
snd-usb-audio: probe of 1-8:1.0 failed with error -5

Some people are working around this by recompiling usb-audio with the call to snd_usb_create_mixer() commented out. It would be nice to avoid that.

While the best idea would be to look into the mixer creation failure, a reasonable short-term solution is to use quirks to only probe the trouble-free interfaces. This allows audio and MIDI interfaces to be used without any obvious issues.

Interface 0 is the main one to ignore. It contains lots of control-fu, including the unexpected interface descriptor subtypes. Interface 5 is for firmware updates and I'm not sure how to get support for this. Interface 3 is some sort of control interface that I don't understand:

Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 9
bInCollection 1
baInterfaceNr( 0) 1

Quoted 1 line

Unfortunately your MUA broke lines so the patch cannot be applied cleanly. Please fix your MUA setup and resend, or use an attachment if it doesn't work.

thanks,

Takashi

Quoted 80 lines
---
 sound/usb/quirks-table.h |   52

++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)

sound/usb/quirks-table.h +18 -0
index 88d8ceb..c9dde5f 100644
@@ -2882,6 +2882,58 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 
 {
 	/*
+	 * Focusrite Scarlett 18i6
+	 *
+	 * Avoid mixer creation, which otherwise fails because some of
+	 * the interface descriptor subtypes for interface 0 are
+	 * unknown.  That should be fixed or worked-around but this at
+	 * least allows the device to be used successfully with a DAW
+	 * and an external mixer.  See comments below about other
+	 * ignored interfaces.
+	 */
+	USB_DEVICE(0x1235, 0x8004),
+	.driver_info = (unsigned long) & (const struct
 snd_usb_audio_quirk) {
+		.vendor_name = "Focusrite",
+		.product_name = "Scarlett 18i6",
+		.ifnum = QUIRK_ANY_INTERFACE,
+		.type = QUIRK_COMPOSITE,
+		.data = & (const struct snd_usb_audio_quirk[]) {
+			{
+				/* InterfaceSubClass 1 (Control

Device) */

sound/usb/quirks-table.h +13 -0
+				.ifnum = 0,
+				.type = QUIRK_IGNORE_INTERFACE
+			},
+			{
+				.ifnum = 1,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				.ifnum = 2,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				/* InterfaceSubClass 1 (Control

Device) */

sound/usb/quirks-table.h +9 -0
+				.ifnum = 3,
+				.type = QUIRK_IGNORE_INTERFACE
+			},
+			{
+				.ifnum = 4,
+				.type = QUIRK_MIDI_STANDARD_INTERFACE
+			},
+			{
+				/* InterfaceSubClass 1 (Device

Firmware Update) */

sound/usb/quirks-table.h +12 -0
+				.ifnum = 5,
+				.type = QUIRK_IGNORE_INTERFACE
+			},
+			{
+				.ifnum = -1
+			}
+		}
+	}
+},
+
+{
+	/*
 	 * Some USB MIDI devices don't have an audio control interface,
 	 * so we have to grab MIDI streaming interfaces here.
 	 */
Signature · 6 lines
1.7.10.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#2 lore raw
Quoted 3 lines · Takashi Iwai

Unfortunately your MUA broke lines so the patch cannot be applied cleanly. Please fix your MUA setup and resend, or use an attachment if it doesn't work.

Sorry, that's irritating! Is this better?

peace & happiness,
martin

p.s. I can't see another way of adding a comment like this above the patch, other than the scissors thing that is processed by "git am -c". Sorry, I don't know how standard this is...

--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- Probing this device currently fails in snd_usb_audio_probe() because the call to snd_usb_create_mixer() fails. This is due to unknown or non-standard interface descriptor subtypes in parse_audio_unit():

usbaudio: unit 51: unexpected type 0x09
snd-usb-audio: probe of 1-8:1.0 failed with error -5

Some people are working around this by recompiling usb-audio with the call to snd_usb_create_mixer() commented out. It would be nice to avoid that.

While the best idea would be to look into the mixer creation failure, a reasonable short-term solution is to use quirks to only probe the trouble-free interfaces. This allows audio and MIDI interfaces to be used without any obvious issues.

Interface 0 is the main one to ignore. It contains lots of control-fu, including the unexpected interface descriptor subtypes. Interface 5 is for firmware updates and I'm not sure how to get support for this. Interface 3 is some sort of control interface that I don't understand:

Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 9
bInCollection 1
baInterfaceNr( 0) 1

---
 sound/usb/quirks-table.h |   52 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
sound/usb/quirks-table.h +52 -0
index 88d8ceb..c9dde5f 100644
@@ -2882,6 +2882,58 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 
 {
 	/*
+	 * Focusrite Scarlett 18i6
+	 *
+	 * Avoid mixer creation, which otherwise fails because some of
+	 * the interface descriptor subtypes for interface 0 are
+	 * unknown.  That should be fixed or worked-around but this at
+	 * least allows the device to be used successfully with a DAW
+	 * and an external mixer.  See comments below about other
+	 * ignored interfaces.
+	 */
+	USB_DEVICE(0x1235, 0x8004),
+	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+		.vendor_name = "Focusrite",
+		.product_name = "Scarlett 18i6",
+		.ifnum = QUIRK_ANY_INTERFACE,
+		.type = QUIRK_COMPOSITE,
+		.data = & (const struct snd_usb_audio_quirk[]) {
+			{
+				/* InterfaceSubClass 1 (Control Device) */
+				.ifnum = 0,
+				.type = QUIRK_IGNORE_INTERFACE
+			},
+			{
+				.ifnum = 1,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				.ifnum = 2,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				/* InterfaceSubClass 1 (Control Device) */
+				.ifnum = 3,
+				.type = QUIRK_IGNORE_INTERFACE
+			},
+			{
+				.ifnum = 4,
+				.type = QUIRK_MIDI_STANDARD_INTERFACE
+			},
+			{
+				/* InterfaceSubClass 1 (Device Firmware Update) */
+				.ifnum = 5,
+				.type = QUIRK_IGNORE_INTERFACE
+			},
+			{
+				.ifnum = -1
+			}
+		}
+	}
+},
+
+{
+	/*
 	 * Some USB MIDI devices don't have an audio control interface,
 	 * so we have to grab MIDI streaming interfaces here.
 	 */
Signature · 1 line
1.7.10.4
#3 lore raw

At Tue, 13 Nov 2012 19:38:03 +1100,

Quoted 7 lines · Martin Schwenke
Quoted 3 lines · Takashi Iwai

Unfortunately your MUA broke lines so the patch cannot be applied cleanly. Please fix your MUA setup and resend, or use an attachment if it doesn't work.

Quoted 8 lines

Sorry, that's irritating! Is this better?

peace & happiness,
martin

p.s. I can't see another way of adding a comment like this above the patch, other than the scissors thing that is processed by "git am -c". Sorry, I don't know how standard this is...

No problem, I applied the patch now.

Thanks.

Takashi

Quoted 114 lines

--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<--8<-- Probing this device currently fails in snd_usb_audio_probe() because the call to snd_usb_create_mixer() fails. This is due to unknown or non-standard interface descriptor subtypes in parse_audio_unit():

usbaudio: unit 51: unexpected type 0x09
snd-usb-audio: probe of 1-8:1.0 failed with error -5

Some people are working around this by recompiling usb-audio with the call to snd_usb_create_mixer() commented out. It would be nice to avoid that.

While the best idea would be to look into the mixer creation failure, a reasonable short-term solution is to use quirks to only probe the trouble-free interfaces. This allows audio and MIDI interfaces to be used without any obvious issues.

Interface 0 is the main one to ignore. It contains lots of control-fu, including the unexpected interface descriptor subtypes. Interface 5 is for firmware updates and I'm not sure how to get support for this. Interface 3 is some sort of control interface that I don't understand:

Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 9
bInCollection 1
baInterfaceNr( 0) 1

---
 sound/usb/quirks-table.h |   52 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
sound/usb/quirks-table.h +52 -0
index 88d8ceb..c9dde5f 100644
@@ -2882,6 +2882,58 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 
 {
 	/*
+	 * Focusrite Scarlett 18i6
+	 *
+	 * Avoid mixer creation, which otherwise fails because some of
+	 * the interface descriptor subtypes for interface 0 are
+	 * unknown.  That should be fixed or worked-around but this at
+	 * least allows the device to be used successfully with a DAW
+	 * and an external mixer.  See comments below about other
+	 * ignored interfaces.
+	 */
+	USB_DEVICE(0x1235, 0x8004),
+	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+		.vendor_name = "Focusrite",
+		.product_name = "Scarlett 18i6",
+		.ifnum = QUIRK_ANY_INTERFACE,
+		.type = QUIRK_COMPOSITE,
+		.data = & (const struct snd_usb_audio_quirk[]) {
+			{
+				/* InterfaceSubClass 1 (Control Device) */
+				.ifnum = 0,
+				.type = QUIRK_IGNORE_INTERFACE
+			},
+			{
+				.ifnum = 1,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				.ifnum = 2,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				/* InterfaceSubClass 1 (Control Device) */
+				.ifnum = 3,
+				.type = QUIRK_IGNORE_INTERFACE
+			},
+			{
+				.ifnum = 4,
+				.type = QUIRK_MIDI_STANDARD_INTERFACE
+			},
+			{
+				/* InterfaceSubClass 1 (Device Firmware Update) */
+				.ifnum = 5,
+				.type = QUIRK_IGNORE_INTERFACE
+			},
+			{
+				.ifnum = -1
+			}
+		}
+	}
+},
+
+{
+	/*
 	 * Some USB MIDI devices don't have an audio control interface,
 	 * so we have to grab MIDI streaming interfaces here.
 	 */
Signature · 1 line
1.7.10.4
#4 lore raw

Hi everyone,

Last week on #alsa I found yet another person who's having problems with snd-usb-audio not supporting UAC2 Feature units. Worse still the relevant part of the descriptor is incomplete according to lsusb so while the device is in the main compliant the feature unit has a descriptor that lsusb thinks is too short and I suspect isn't compliant (so even if we were trying to parse feature units it'd blow up here)

AudioControl Interface Descriptor: bLength
16 bDescriptorType 36 bDescriptorSubtype 9
(EXTENSION_UNIT) Warning: Descriptor too short bUnitID
51 wExtensionCode 0 bNrPins
1 baSourceID( 0) 2 bNrChannels
4 wChannelConfig 0 iChannelNames 3

       bmControls        0x00        iExtension             26

(a full lsusb -v is here: http://pastebin.ubuntu.com/1451668/)
So while we could submit another quirk for this to ignore the mixer for now. and this would probably make the device "work" without access to the feature unit is it sensible? (we verified that modifying martin's quirk above (just changing vid:pid) was enough to make the device "work")

Note also this is the problem for the eleven rack as discussed in April
http://mailman.alsa-project.org/pipermail/alsa-devel/2012-April/050899.html

How difficult would it be to have the mixer/control code just "skip" feature units rather than the current failure mode? or default to ignore the interface if the control parser fails but continue to remaining interfaces? I've tried understanding this code. but my C foo is lacking.

Grant.

#5 lore raw
Quoted 2 lines · Grant Diffey

Last week on #alsa I found yet another person who's having problems with snd-usb-audio not supporting UAC2 Feature units.

This is an extension unit. The driver not handling it is yet another bug.

Quoted 2 lines

Worse still the relevant part of the descriptor is incomplete according to lsusb

lsusb might be as error-free as snd-usb-audio, and in any case an incomplete descriptor for some random mixer control should be no reason to refuse working with the device altogether.

Quoted 3 lines

So while we could submit another quirk for this to ignore the mixer for now. and this would probably make the device "work" without access to the feature unit is it sensible?

The sensible thing to do is to review the entire new descriptor parsing code to remove all invalid and overzealous error cases.

Regards,
Clemens