Skip to contentSkip to conversation

A plea for help on mixer support for Fast Track Ultra (8R)

PATCH Felix Homann 5 participants 34 messages May 18, 2011 – May 24, 2011 Sound

lore
Share & tools
lore
#0 lore raw

Hi,

I need some help again by someone who's more familiar with Alsa's inner working than I am. This might be you, Daniel ;-)

I've attached a patch series that would add support for the mixer in M-Audio's Fast Track Ultra (8R) devices.

BUT, it will break others!

It will break others in that mixer controls will show up multiple times. The reason for this seems to be my ambitiuos calling of snd_usb_create_mixer() for quirked devices in card.c. To circumvent the problem of a control showing up multiple times, I check for duplicates in add_unique_control_to_empty_mixer() and skip controls already present.

This doesn't work for devices which are not using add_unique_control_to_empty_mixer(), in other words *all* devices not using my messy patch...

So, probably the best thing would be to have some kind of entry in quirks-table.h to tell which device would need to be "mixerquirked" to prevent other devices to be disturbed. How can this be done?

I would highly appreciate anybody coming up with a proper solution.

Kind regards,

Felix

Quoted 1 line

From d698eefa94673ab9869de2614338cd2e0998ab3a Mon Sep 17 00:00:00 2001

From: Felix Homann <fex@yerbouti>
Date: Wed, 18 May 2011 09:09:24 +0200
Subject: [PATCH - Basic mixer support for Fast Track Ultra 1/6]Raise MAX_CHANNELS to 16 as needed by Fast TRack Ultra (8R)

sound/usb/mixer.h +1 -1
index b4a2c81..06d035f 100644
@@ -24,7 +24,7 @@ struct usb_mixer_interface {
 	u8 xonar_u1_status;
 };
 
-#define MAX_CHANNELS	10	/* max logical channels */
+#define MAX_CHANNELS	16	/* max logical channels */
 
 struct usb_mixer_elem_info {
 	struct usb_mixer_interface *mixer;
Signature · 1 line
1.7.4.1
Quoted 1 line

From 1319e39fc58114f7d277966a845b09b47dbb3730 Mon Sep 17 00:00:00 2001

From: Felix Homann <[email protected]>
Date: Wed, 18 May 2011 09:17:44 +0200
Subject: [PATCH - Basic mixer support for Fast Track Ultra 2/6]Move USB_MIXER_ enum to mixer.h
This facilitates using it in mixer_quirks.c

sound/usb/mixer.c +0 -10
index 5e47757..ea95ce2 100644
@@ -86,16 +86,6 @@ struct mixer_build {
 	const struct usbmix_selector_map *selector_map;
 };
 
-enum {
-	USB_MIXER_BOOLEAN,
-	USB_MIXER_INV_BOOLEAN,
-	USB_MIXER_S8,
-	USB_MIXER_U8,
-	USB_MIXER_S16,
-	USB_MIXER_U16,
-};
-
-
 /*E-mu 0202/0404/0204 eXtension Unit(XU) control*/
 enum {
 	USB_XU_CLOCK_RATE 		= 0xe301,
sound/usb/mixer.h +9 -0
index 06d035f..86af922 100644
@@ -1,6 +1,15 @@
 #ifndef __USBMIXER_H
 #define __USBMIXER_H
 
+enum {
+	USB_MIXER_BOOLEAN,
+	USB_MIXER_INV_BOOLEAN,
+	USB_MIXER_S8,
+	USB_MIXER_U8,
+	USB_MIXER_S16,
+	USB_MIXER_U16,
+};
+
 struct usb_mixer_interface {
 	struct snd_usb_audio *chip;
 	struct list_head list;
Signature · 1 line
1.7.4.1
Quoted 1 line

From 84a7175d0c05e5f9cf2a6d7c682ba6904686df64 Mon Sep 17 00:00:00 2001

From: Felix Homann <[email protected]>
Date: Wed, 18 May 2011 10:05:34 +0200
Subject: [PATCH - Basic mixer support for Fast Track Ultra 3/6]Add mixer quirk for Fast Track Ultra devices

sound/usb/mixer.c +76 -0

88 lines not on this page · raw message

sound/usb/mixer.h +3 -0
index 86af922..6fe7bea 100644
@@ -61,6 +61,9 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
 
 int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
 				int request, int validx, int value_set);
+int build_named_mixer_unit_ctl(struct usb_mixer_interface *mixer,
+		int in_pin, int in_ch, int unitid, int val_type, 
+		unsigned int cmask, char* ctrl_name, int channels);
 void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer);
 int snd_usb_mixer_activate(struct usb_mixer_interface *mixer);
 
sound/usb/mixer_quirks.c +34 -0
index 73dcc82..e87f359 100644
@@ -500,6 +500,36 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
 	}
 }
 
+/*
+ * Create mixer controls for Fast Track Ultra (8R)
+ */
+int snd_ftu_controls_create(struct usb_mixer_interface *mixer)
+{
+	char name[44];
+	int out, in_ch, unitid, err;
+	unsigned int cmask;
+	int val_type =  USB_MIXER_S16;
+	int channels = 1; /* mono channels */
+	
+	unitid = 5; // FTU's unit id
+	for (out = 0; out < 8; ++out) {
+		for (in_ch = 0; in_ch < 16; ++in_ch) {
+				cmask = (1 << in_ch);
+			if (in_ch < 8)
+				sprintf(name, "AIn%d - Out%d Capture Volume", in_ch + 1, out + 1);
+			else if (in_ch >= 8)
+				sprintf(name, "DIn%d - Out%d Playback Volume", in_ch - 7, out + 1);     
+			if ((err = build_named_mixer_unit_ctl(mixer, in_ch, out, unitid, 
+				val_type, cmask, name, channels))) {
+				return err;
+			}
+		}
+	}
+	
+	return 0;
+}
+
+
 int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 {
 	int err = 0;
@@ -537,6 +567,10 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 				snd_nativeinstruments_ta10_mixers,
 				ARRAY_SIZE(snd_nativeinstruments_ta10_mixers));
 		break;
+	case USB_ID(0x0763, 0x2080):/* M-Audio Fast Track Ultra */
+	case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */
+		err = snd_ftu_controls_create(mixer);
+		break;
 	}
 
 	return err;
Signature · 1 line
1.7.4.1
Quoted 1 line

From 67da1908c4dd0e10a24f65d321875fae3dae7a42 Mon Sep 17 00:00:00 2001

From: Felix Homann <[email protected]>
Date: Wed, 18 May 2011 10:40:22 +0200
Subject: [PATCH - Basic mixer support for Fast Track Ultra 5/6]Try to create a mixer for quirked devices, too

sound/usb/card.c +5 -0
index 40722f8..52ad7b0 100644
@@ -493,6 +493,11 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
 	 */
 	if (!chip->ctrl_intf)
 		chip->ctrl_intf = alts;
+	
+	/* try to create a mixer for quirked devices, too */
+	if (snd_usb_create_mixer(chip, ifnum, ignore_ctl_error) < 0) {
+		goto __error;
+	}
 
 	if (err > 0) {
 		/* create normal USB audio interfaces */
Signature · 1 line
1.7.4.1
#1 lore raw

Sorry for the mail formated patches!

Here's a single combined patch.

Regards,

Felix

Am 18.05.2011 17:19, schrieb Felix Homann:

Quoted 18 lines

Hi,

I need some help again by someone who's more familiar with Alsa's inner working than I am. This might be you, Daniel ;-)

I've attached a patch series that would add support for the mixer in M-Audio's Fast Track Ultra (8R) devices.

BUT, it will break others!

It will break others in that mixer controls will show up multiple times. The reason for this seems to be my ambitiuos calling of snd_usb_create_mixer() for quirked devices in card.c. To circumvent the problem of a control showing up multiple times, I check for duplicates in add_unique_control_to_empty_mixer() and skip controls already present.

This doesn't work for devices which are not using add_unique_control_to_empty_mixer(), in other words *all* devices not using my messy patch...

So, probably the best thing would be to have some kind of entry in quirks-table.h to tell which device would need to be "mixerquirked" to prevent other devices to be disturbed. How can this be done?

I would highly appreciate anybody coming up with a proper solution.

Kind regards,

Quoted 7 lines

Felix

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

sound/usb/card.c +5 -0
index 40722f8..52ad7b0 100644
@@ -493,6 +493,11 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
 	 */
 	if (!chip->ctrl_intf)
 		chip->ctrl_intf = alts;
+	
+	/* try to create a mixer for quirked devices, too */
+	if (snd_usb_create_mixer(chip, ifnum, ignore_ctl_error) < 0) {
+		goto __error;
+	}
 
 	if (err > 0) {
 		/* create normal USB audio interfaces */
sound/usb/mixer.c +76 -10

104 lines not on this page · raw message

sound/usb/mixer.h +13 -1
index b4a2c81..6fe7bea 100644
@@ -1,6 +1,15 @@
 #ifndef __USBMIXER_H
 #define __USBMIXER_H
 
+enum {
+	USB_MIXER_BOOLEAN,
+	USB_MIXER_INV_BOOLEAN,
+	USB_MIXER_S8,
+	USB_MIXER_U8,
+	USB_MIXER_S16,
+	USB_MIXER_U16,
+};
+
 struct usb_mixer_interface {
 	struct snd_usb_audio *chip;
 	struct list_head list;
@@ -24,7 +33,7 @@ struct usb_mixer_interface {
 	u8 xonar_u1_status;
 };
 
-#define MAX_CHANNELS	10	/* max logical channels */
+#define MAX_CHANNELS	16	/* max logical channels */
 
 struct usb_mixer_elem_info {
 	struct usb_mixer_interface *mixer;
@@ -52,6 +61,9 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
 
 int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
 				int request, int validx, int value_set);
+int build_named_mixer_unit_ctl(struct usb_mixer_interface *mixer,
+		int in_pin, int in_ch, int unitid, int val_type, 
+		unsigned int cmask, char* ctrl_name, int channels);
 void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer);
 int snd_usb_mixer_activate(struct usb_mixer_interface *mixer);
 
sound/usb/mixer_quirks.c +34 -0
index 73dcc82..e87f359 100644
@@ -500,6 +500,36 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
 	}
 }
 
+/*
+ * Create mixer controls for Fast Track Ultra (8R)
+ */
+int snd_ftu_controls_create(struct usb_mixer_interface *mixer)
+{
+	char name[44];
+	int out, in_ch, unitid, err;
+	unsigned int cmask;
+	int val_type =  USB_MIXER_S16;
+	int channels = 1; /* mono channels */
+	
+	unitid = 5; // FTU's unit id
+	for (out = 0; out < 8; ++out) {
+		for (in_ch = 0; in_ch < 16; ++in_ch) {
+				cmask = (1 << in_ch);
+			if (in_ch < 8)
+				sprintf(name, "AIn%d - Out%d Capture Volume", in_ch + 1, out + 1);
+			else if (in_ch >= 8)
+				sprintf(name, "DIn%d - Out%d Playback Volume", in_ch - 7, out + 1);     
+			if ((err = build_named_mixer_unit_ctl(mixer, in_ch, out, unitid, 
+				val_type, cmask, name, channels))) {
+				return err;
+			}
+		}
+	}
+	
+	return 0;
+}
+
+
 int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 {
 	int err = 0;
@@ -537,6 +567,10 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 				snd_nativeinstruments_ta10_mixers,
 				ARRAY_SIZE(snd_nativeinstruments_ta10_mixers));
 		break;
+	case USB_ID(0x0763, 0x2080):/* M-Audio Fast Track Ultra */
+	case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */
+		err = snd_ftu_controls_create(mixer);
+		break;
 	}
 
 	return err;
#2 lore raw
In reply to Felix Homann

HI Felix,

Quoted 6 lines · Felix Homann

I need some help again by someone who's more familiar with Alsa's inner working than I am. This might be you, Daniel ;-)

I've attached a patch series that would add support for the mixer in M-Audio's Fast Track Ultra (8R) devices.

Quoted 7 lines

BUT, it will break others!

It will break others in that mixer controls will show up multiple times. The reason for this seems to be my ambitiuos calling of snd_usb_create_mixer() for quirked devices in card.c. To circumvent the problem of a control showing up multiple times, I check for duplicates in add_unique_control_to_empty_mixer() and skip controls already present.

Hmm, I'm not sure whether I understand what you're trying to do. You want to add mixers that are not added by the generic driver? Then just have a look how this is done for other devices, like for example for the "Traktor Audio 10". Or do I miss your point?

As a general rule, let the check-patch.pl script that ships with the kernel have a look at your patches, it will point out obvious coding style issues and the like :)

Daniel

#3 lore raw

Hi Daniel,

Am 18.05.2011 19:51, schrieb Daniel Mack:

Quoted 3 lines

Hmm, I'm not sure whether I understand what you're trying to do. You want to add mixers that are not added by the generic driver?

I'm adding a mixer to a device that doesn't even tell the driver that a mixer is present. There's no descriptor for it whatsoever. Nevertheless, you can control the mixer just like a standard usb audio mixer. Therefore I wanted to reuse as much of already present code as possible. Most of all I didn't want to construct any URBs or write new control_get or _put functions.

The problem is not how to get the mixer for the Fast Track Ultra (FTU) working. The problem is how to do it without breaking other mixers ;-)

The main problem at the moment is that snd_usb_create_mixer() will not be called on quirked devices! Take a look at card.c:
snd_usb_create_mixer() will only be called if snd_usb_create_quirk() returns > 0. But why should we assume that quirked devices don't have any mixers?

I have forced calling snd_usb_create_mixer() for every device in my patch set. But this way controls from other devices will show up multiple times. We definetely don't want that.

If snd_usb_create_mixer() will be called for the FTU then the rest of my patch set works just fine. So how can I tell card.c to call it? I think a generic solution would be best, like some entry in quirks-table.h.

Quoted 3 lines

As a general rule, let the check-patch.pl script that ships with the kernel have a look at your patches, it will point out obvious coding style issues and the like :)

I knew it wasn't ready for submission. After generating the patch I send I had already corrected the whitespaces and those lines with over 80 characters that weren't just copies from other locations. The remaining issues like "! cval" and "ERROR: do not use assignment in if condition" were all taken literally from other locations inside the respective files. So, besides one C99 comment it's very much in style with the files I've been working on ;-)

Regards,

Felix

#4 lore raw
Quoted 11 lines · Felix Homann

Am 18.05.2011 19:51, schrieb Daniel Mack:

Quoted 3 lines

Hmm, I'm not sure whether I understand what you're trying to do. You want to add mixers that are not added by the generic driver?

I'm adding a mixer to a device that doesn't even tell the driver that a mixer is present. There's no descriptor for it whatsoever. Nevertheless, you can control the mixer just like a standard usb audio mixer. Therefore I wanted to reuse as much of already present code as possible. Most of all I didn't want to construct any URBs or write new control_get or _put functions.

Ok, I see your point. Well in that case, I would add the mixers in mixer_quirks.c just like you did in your patch, but I would basically copy some code from build_feature_ctl() and allocate and fill a special cval from within your quirk function. I would suggest making usb_feature_unit_ctl (the struct) public (remove the static, prefix the name with snd_usb_ and add the prototype to the header), so you can reference it from mixer_quirks.c. That way, you would keep all the _info, _get and _put functions privately to mixer.c, but still have the ability to reuse most of the code. You just need to fill your cval with data the generic functions can cope with. Does that make sense?

Quoted 2 lines

The problem is not how to get the mixer for the Fast Track Ultra (FTU) working. The problem is how to do it without breaking other mixers ;-)

You wouldn't alter any existing code that way, and just add special stuff for this device.

Quoted 4 lines

The main problem at the moment is that snd_usb_create_mixer() will not be called on quirked devices! Take a look at card.c: snd_usb_create_mixer() will only be called if snd_usb_create_quirk() returns > 0. But why should we assume that quirked devices don't have any mixers?

That is indeed strange, yes. I can't explain that. Not to break existing devices, I would suggest adding a bit-wise "flags" field to snd_usb_audio_quirk and still create the mixers if a certain flag (something like "QUIRK_FLAG_CREATE_STANDARD_MIXERS") is set. Clemens, Takashi, would that be ok?

In general, note that as long as functions are static, the can and should have short names. But once they're not, you're in the global kernel namespace, and all symbols must be well prefixed (with "snd_usb_" in that case) in order to avoid name collisions.

Daniel

#5 lore raw

Daniel,

Quoted 12 lines

The main problem at the moment is that snd_usb_create_mixer() will not be

Quoted 2 lines

called on quirked devices! Take a look at card.c: snd_usb_create_mixer() will only be called if snd_usb_create_quirk() returns > 0. But why should

we

Quoted 1 line

assume that quirked devices don't have any mixers?

That is indeed strange, yes. I can't explain that. Not to break existing devices, I would suggest adding a bit-wise "flags" field to snd_usb_audio_quirk and still create the mixers if a certain flag (something like "QUIRK_FLAG_CREATE_STANDARD_MIXERS") is set. Clemens, Takashi, would that be ok?

Quoted 6 lines

In general, note that as long as functions are static, the can and should have short names. But once they're not, you're in the global kernel namespace, and all symbols must be well prefixed (with "snd_usb_" in that case) in order to avoid name collisions.

So this is probably a terrible idea but what about creating a new quirk

QUIRK_MIXER_STANDARD_INTERFACE and just having that eventually call snd_usb_create_mixer()

because conceptually I could see this as two problems with two solutions. one is that the interface type/blah is the mixer is a lie (vendor_specific instead of UAC2 MIXER . (should be solved via a "quirk" in quirk-table.h) and

The other is that the endpoint descriptors within that are wrong (solved in mixer_quirks)

or am I thinking about this wrong?

Grant.

#6 lore raw
In reply to Daniel Mack

At Wed, 18 May 2011 23:30:46 +0200,

Quoted 11 lines · Daniel Mack
Quoted 5 lines

The main problem at the moment is that snd_usb_create_mixer() will not be called on quirked devices! Take a look at card.c: snd_usb_create_mixer() will only be called if snd_usb_create_quirk() returns > 0. But why should we assume that quirked devices don't have any mixers?

That is indeed strange, yes. I can't explain that. Not to break existing devices, I would suggest adding a bit-wise "flags" field to snd_usb_audio_quirk and still create the mixers if a certain flag (something like "QUIRK_FLAG_CREATE_STANDARD_MIXERS") is set. Clemens, Takashi, would that be ok?

Returning zero means that you don't follow any standard.
In the comment of snd_usb_create_quirk:
/*
* audio-interface quirks
*
* returns zero if no standard audio/MIDI parsing is needed.
* returns a positive value if standard audio/midi interfaces are parsed
* after this.
* returns a negative value at error.
*/

I see no big reason to make things more complex. If you want to avoid the standard audio parsing after quirk but only parse mixer, just call snd_usb_create_mixer() in your quirk function.

thanks,

Takashi

#7 lore raw

Am 19.05.2011 07:42, schrieb Takashi Iwai:

Quoted 4 lines

I see no big reason to make things more complex. If you want to avoid the standard audio parsing after quirk but only parse mixer, just call snd_usb_create_mixer() in your quirk function.

Maybe I'm misunderstanding your point. But I think your suggestion is making things more complex.

I don't want to avoid the standard audio parsing. I want to use standard quirks if possible and still would like a means to call snd_usb_create_mixer(). That's all.

The device in question can be handled by a standard quirks (QUIRK_ANY_INTERFACE, QUIRK_COMPOSITE, QUIRK_AUDIO_FIXED_ENDPOINT). There's no hook for calling snd_usb_create_mixer() by the respective quirk functions, is there? Should I really need not to use those standard quirks just to call snd_usb_create_mixer()?

Moreover, I can't believe that the Fast Track Ultra devices are the only ones in the world which have a standard USB mixer without exposing it through the descriptors. (I've often read something like "but the mixer won't work") A simple generic standard way to handle those devices would be nice to have.

Take a look at it from my perspective: I'm just a layman on all of this. I full heartedly confess, that I don't actually understand all those functions involved in making a mixer work. I don't understand usb control messages an so on.
For example, take a look at the snd_nativeinstruments_control_put() function as Daniel suggested. There's a line

usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, cpu_to_le16(wValue), cpu_to_le16(wIndex), NULL, 0, 1000);

What is it? How is anyone not deeply involved with USB programming and/or audio device programming supposed to understand it? How is anybody supposed to help Alsa development to get his device working without deeply diving into all this stuff *which should not be needed*?

But being a layman I could still understand that the mixer unit in my device is there and that it is controlled by standard usb commands (control messages?). So what to do next?

For the capture, playback and MIDI side it's already simple: If you have a device that you suspect to be more or less standard compliant but just doesn't tell the world about it he can just try some combinations of QUIRK_AUDIO_FIXED_ENDPOINT, QUIRK_AUDIO_STANDARD_INTERFACE, QUIRK_MIDI_FIXED_ENDPOINT etc. (which by the way are still not easy to understand due to lack of documentation!).

For mixers, there isn't such a standard way. That's what I would like to have! And that's what I have at least sketched with my patch. (While the standard way to tell the driver to call snd_usb_create_mixer() is still missing.)

Take a look at my (maybe naive?) snd_ftu_controls_create() function. It's easy to understand, it's simple:
I essentially just pass channel numbers, and names to build_named_mixer_unit_ctl() which is a slightly modified version of build_mixer_unit_ctl() and voila: I get a volume control for the respective mixer channel, just as if the control had been known from a descriptor. That's a lot easier to understand than fiddling around with usb_control_msg(), isn't it?

So, at the end as stated above, I would like to see a simple, easy to understand standard way to handle a mixer that essentially *is* a standard USB audio mixer but doesn't tell the world about it...And of course, it should work with my device ;-)

Kind regards,

Felix

#8 lore raw
Quoted 11 lines · Felix Homann

Am 19.05.2011 07:42, schrieb Takashi Iwai:

Quoted 3 lines

I see no big reason to make things more complex. If you want to avoid the standard audio parsing after quirk but only parse mixer, just call snd_usb_create_mixer() in your quirk function.

Maybe I'm misunderstanding your point. But I think your suggestion is making things more complex.

I don't want to avoid the standard audio parsing. I want to use standard quirks if possible and still would like a means to call snd_usb_create_mixer(). That's all.

The quirks-table.h framework handles only quirks that attach to a USB interface. So create a FTU mixer quirk for intf 0 (or a generic quirk with a separate table of mixer controls).

Quoted 3 lines

Moreover, I can't believe that the Fast Track Ultra devices are the only ones in the world which have a standard USB mixer without exposing it through the descriptors.

So far, they are the only ones where somebody bothered to find out what the controls are.

(Many vendor-specific controls don't implement the complex class- compliant mixer protocol.)

Quoted 6 lines

I knew it wasn't ready for submission. After generating the patch I send I had already corrected the whitespaces and those lines with over 80 characters that weren't just copies from other locations. The remaining issues like "! cval" and "ERROR: do not use assignment in if condition" were all taken literally from other locations inside the respective files.

"Do as I say, not as I do." ;-)

Regards,
Clemens

#9 lore raw
In reply to Felix Homann

At Thu, 19 May 2011 08:45:43 +0200,

Quoted 7 lines · Felix Homann

Am 19.05.2011 07:42, schrieb Takashi Iwai:

Quoted 4 lines

I see no big reason to make things more complex. If you want to avoid the standard audio parsing after quirk but only parse mixer, just call snd_usb_create_mixer() in your quirk function.

Quoted 6 lines

Maybe I'm misunderstanding your point. But I think your suggestion is making things more complex.

I don't want to avoid the standard audio parsing. I want to use standard quirks if possible and still would like a means to call snd_usb_create_mixer(). That's all.

First off, there is no "standard" quirk per definition :) There can be common quirks used by multiple devices, but this doesn't justify the fact that it's no standard USB-audio.

In principle, quirks are provided to be self-contained. If it's not compliant to standard usb-audio, handle everything there -- that's the whole policy. If we add yet another condition here and there in the main path for specific devices, it'll make readability worse.

(Or, think like OO implementation: if you want to implement a variant,
you wouldn't put new conditional branch, but usually override the necessary parts.)

In this particular case, you can call snd_usb_create_mixer() then create your mixer elements in addition in your quirk function. This is more straightforward than adding branches in multiple points.

Of course, there can be some room for refactoring to share codes between different quirks. But it's a thing to be done in quirk codes.

Quoted 54 lines

The device in question can be handled by a standard quirks (QUIRK_ANY_INTERFACE, QUIRK_COMPOSITE, QUIRK_AUDIO_FIXED_ENDPOINT). There's no hook for calling snd_usb_create_mixer() by the respective quirk functions, is there? Should I really need not to use those standard quirks just to call snd_usb_create_mixer()?

Moreover, I can't believe that the Fast Track Ultra devices are the only ones in the world which have a standard USB mixer without exposing it through the descriptors. (I've often read something like "but the mixer won't work") A simple generic standard way to handle those devices would be nice to have.

Take a look at it from my perspective: I'm just a layman on all of this. I full heartedly confess, that I don't actually understand all those functions involved in making a mixer work. I don't understand usb control messages an so on.
For example, take a look at the snd_nativeinstruments_control_put() function as Daniel suggested. There's a line

usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, cpu_to_le16(wValue), cpu_to_le16(wIndex), NULL, 0, 1000);

What is it? How is anyone not deeply involved with USB programming and/or audio device programming supposed to understand it? How is anybody supposed to help Alsa development to get his device working without deeply diving into all this stuff *which should not be needed*?

But being a layman I could still understand that the mixer unit in my device is there and that it is controlled by standard usb commands (control messages?). So what to do next?

For the capture, playback and MIDI side it's already simple: If you have a device that you suspect to be more or less standard compliant but just doesn't tell the world about it he can just try some combinations of QUIRK_AUDIO_FIXED_ENDPOINT, QUIRK_AUDIO_STANDARD_INTERFACE, QUIRK_MIDI_FIXED_ENDPOINT etc. (which by the way are still not easy to understand due to lack of documentation!).

For mixers, there isn't such a standard way. That's what I would like to have! And that's what I have at least sketched with my patch. (While the standard way to tell the driver to call snd_usb_create_mixer() is still missing.)

Take a look at my (maybe naive?) snd_ftu_controls_create() function. It's easy to understand, it's simple:
I essentially just pass channel numbers, and names to build_named_mixer_unit_ctl() which is a slightly modified version of build_mixer_unit_ctl() and voila: I get a volume control for the respective mixer channel, just as if the control had been known from a descriptor. That's a lot easier to understand than fiddling around with usb_control_msg(), isn't it?

Quoted 4 lines

So, at the end as stated above, I would like to see a simple, easy to understand standard way to handle a mixer that essentially *is* a standard USB audio mixer but doesn't tell the world about it...And of course, it should work with my device ;-)

What I'm thinking is also to keep the thing simple.
My points are:
- Try to avoid conditional branches, don't touch the main path as much as possible
- You can call the standard parsers in the quirk itself
- You can create additional mixer contents in the quirk as well (so just use your simplified snd_ftu_controls_create()).

thanks,

Takashi

#10 lore raw

Please, Clemens, Daniel and Takashi.

Every single one of you knows at least one way of doing it correctly. I don't.

I don't understand most of your suggestions, I don't understand the whole quirk framework. I'm just a layman who knows one way of making the FTU mixer work which would break others (just by calling snd_usb_create_mixer() too many times).

The "blueprint patch" I've send is very small. It's just three functions, one of them is very simple the others are almost identical to already present functions.

So please, couldn't someone fill the gap between what I have found and a proper implementation? As I see it, you might easily spend the same amount of time explaining to me how it should be done or why my next proposed patch (which would probably take at least a couple of weeks) is not acceptable and so on. But this would probably run for weeks or even months.

Please, help.

Thanks,

Felix

Am 19.05.2011 09:24, schrieb Takashi Iwai:

Quoted 5 lines

In this particular case, you can call snd_usb_create_mixer() then create your mixer elements in addition in your quirk function. This is more straightforward than adding branches in multiple points.

Quoted 10 lines

Of course, there can be some room for refactoring to share codes between different quirks. But it's a thing to be done in quirk codes.
What I'm thinking is also to keep the thing simple.
My points are:
- Try to avoid conditional branches, don't touch the main path as much as possible
- You can call the standard parsers in the quirk itself
- You can create additional mixer contents in the quirk as well (so just use your simplified snd_ftu_controls_create()).

Am 19.05.2011 09:15, schrieb Clemens Ladisch:

Quoted 4 lines

So create a FTU mixer quirk for intf 0 (or a generic quirk with a separate table of mixer controls).

Am 18.05.2011 23:30, schrieb Daniel Mack:

Quoted 11 lines

Well in that case, I would add the mixers in
mixer_quirks.c just like you did in your patch, but I would basically copy some code from build_feature_ctl() and allocate and fill a special cval from within your quirk function. I would suggest making usb_feature_unit_ctl (the struct) public (remove the static, prefix the name with snd_usb_ and add the prototype to the header), so you can reference it from mixer_quirks.c. That way, you would keep all the _info, _get and _put functions privately to mixer.c, but still have the ability to reuse most of the code. You just need to fill your cval with data the generic functions can cope with. Does that make sense?

#11 lore raw
Quoted 14 lines · Felix Homann

Please, Clemens, Daniel and Takashi.

Every single one of you knows at least one way of doing it correctly. I don't.

I don't understand most of your suggestions, I don't understand the whole quirk framework. I'm just a layman who knows one way of making the FTU mixer work which would break others (just by calling snd_usb_create_mixer() too many times).

The "blueprint patch" I've send is very small. It's just three functions, one of them is very simple the others are almost identical to already present functions.

Quoted 5 lines

So please, couldn't someone fill the gap between what I have found and a proper implementation? As I see it, you might easily spend the same amount of time explaining to me how it should be done or why my next proposed patch (which would probably take at least a couple of weeks) is not acceptable and so on. But this would probably run for weeks or even months.

I'll have a look later. I was just under the impression you wanted to try yourself :)

Daniel

#12 lore raw

Great Daniel, thank you in advance!

I would really like to do it myself. It's just not a good time for me too dive further into the Alsa working. I wouldn't have brought the mixer thing up this time without being pushed again by Grant and some others. So I guess it's better for everybody to have the basic mixer controls in Alsa as soon as possible than to wait until I get it right ;-) Especially those with a FTU will appreciate that.

I'll probably have a bit more time from mid June to end of July, so maybe we can take a new look at the clicks then, if you still like to.

Thanks,

Felix

Am 19.05.2011 10:52, schrieb Daniel Mack:

Quoted 6 lines

I'll have a look later. I was just under the impression you wanted to try yourself :)

Daniel

#13 lore raw
In reply to Daniel Mack
Quoted 2 lines · Daniel Mack

I'll have a look later. I was just under the impression you wanted to try yourself :)

Attached is a patch which should show how this could work. It won't be fully functional though, as there seems to be some sort of confusion in your patch. You're calling build_named_mixer_unit_ctl() with your loop variable "in_ch", but you ignore that value in the called function. That can't be intentional, can it?

Anyway, very little tweaking should be needed now to make this work, and if you send me back the modified patch, I'll split the work and post a patch set here.

Daniel

sound/usb/card.c +1 -0
index a90662a..e7d1e0d 100644
@@ -48,6 +48,7 @@
 #include <linux/usb/audio.h>
 #include <linux/usb/audio-v2.h>
 
+#include <sound/control.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/pcm.h>
sound/usb/mixer.c +14 -20
index eab06ed..3184d77 100644
@@ -86,16 +86,6 @@ struct mixer_build {
 	const struct usbmix_selector_map *selector_map;
 };
 
-enum {
-	USB_MIXER_BOOLEAN,
-	USB_MIXER_INV_BOOLEAN,
-	USB_MIXER_S8,
-	USB_MIXER_U8,
-	USB_MIXER_S16,
-	USB_MIXER_U16,
-};
-
-
 /*E-mu 0202/0404/0204 eXtension Unit(XU) control*/
 enum {
 	USB_XU_CLOCK_RATE 		= 0xe301,
@@ -535,20 +525,21 @@ static int check_matrix_bitmap(unsigned char *bmap, int ich, int och, int num_ou
  * if failed, give up and free the control instance.
  */
 
-static int add_control_to_empty(struct mixer_build *state, struct snd_kcontrol *kctl)
+int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
+			      struct snd_kcontrol *kctl)
 {
 	struct usb_mixer_elem_info *cval = kctl->private_data;
 	int err;
 
-	while (snd_ctl_find_id(state->chip->card, &kctl->id))
+	while (snd_ctl_find_id(mixer->chip->card, &kctl->id))
 		kctl->id.index++;
-	if ((err = snd_ctl_add(state->chip->card, kctl)) < 0) {
+	if ((err = snd_ctl_add(mixer->chip->card, kctl)) < 0) {
 		snd_printd(KERN_ERR "cannot add control (err = %d)\n", err);
 		return err;
 	}
 	cval->elem_id = &kctl->id;
-	cval->next_id_elem = state->mixer->id_elems[cval->id];
-	state->mixer->id_elems[cval->id] = cval;
+	cval->next_id_elem = mixer->id_elems[cval->id];
+	mixer->id_elems[cval->id] = cval;
 	return 0;
 }
 
@@ -967,7 +958,7 @@ static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 	return changed;
 }
 
-static struct snd_kcontrol_new usb_feature_unit_ctl = {
+struct snd_kcontrol_new usb_feature_unit_ctl = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.name = "", /* will be filled later manually */
 	.info = mixer_ctl_feature_info,
@@ -984,6 +975,9 @@ static struct snd_kcontrol_new usb_feature_unit_ctl_ro = {
 	.put = NULL,
 };
 
+/* This symbol is exported in order to allow the mixer quirks to
+ * hook up to the standard feature unit control mechanism */
+struct snd_kcontrol_new *snd_usb_feature_unit_ctl = &usb_feature_unit_ctl;
 
 /*
  * build a feature control
@@ -1176,7 +1170,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
 
 	snd_printdd(KERN_INFO "[%d] FU [%s] ch = %d, val = %d/%d/%d\n",
 		    cval->id, kctl->id.name, cval->channels, cval->min, cval->max, cval->res);
-	add_control_to_empty(state, kctl);
+	snd_usb_mixer_add_control(state->mixer, kctl);
 }
 
 
@@ -1340,7 +1334,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state,
 
 	snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n",
 		    cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
-	add_control_to_empty(state, kctl);
+	snd_usb_mixer_add_control(state->mixer, kctl);
 }
 
 
@@ -1641,7 +1635,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
 
 		snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n",
 			    cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
-		if ((err = add_control_to_empty(state, kctl)) < 0)
+		if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
 			return err;
 	}
 	return 0;
@@ -1858,7 +1852,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
 
 	snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n",
 		    cval->id, kctl->id.name, desc->bNrInPins);
-	if ((err = add_control_to_empty(state, kctl)) < 0)
+	if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
 		return err;
 
 	return 0;
sound/usb/mixer.h +13 -1
index b4a2c81..ae1a14d 100644
@@ -24,7 +24,16 @@ struct usb_mixer_interface {
 	u8 xonar_u1_status;
 };
 
-#define MAX_CHANNELS	10	/* max logical channels */
+#define MAX_CHANNELS	16	/* max logical channels */
+
+enum {
+	USB_MIXER_BOOLEAN,
+	USB_MIXER_INV_BOOLEAN,
+	USB_MIXER_S8,
+	USB_MIXER_U8,
+	USB_MIXER_S16,
+	USB_MIXER_U16,
+};
 
 struct usb_mixer_elem_info {
 	struct usb_mixer_interface *mixer;
@@ -55,4 +64,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
 void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer);
 int snd_usb_mixer_activate(struct usb_mixer_interface *mixer);
 
+int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
+			      struct snd_kcontrol *kctl);
+
 #endif /* __USBMIXER_H */
sound/usb/mixer_quirks.c +78 -0

96 lines not on this page · raw message

sound/usb/quirks.c +1 -0
index bd13d72..2546dc8 100644
@@ -19,6 +19,7 @@
 #include <linux/usb.h>
 #include <linux/usb/audio.h>
 
+#include <sound/control.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/pcm.h>
#14 lore raw

Hi Daniel,

Am 19.05.2011 13:05, schrieb Daniel Mack:

Quoted 6 lines · Daniel Mack
Quoted 2 lines

I'll have a look later. I was just under the impression you wanted to try yourself :)

Attached is a patch which should show how this could work. It won't be fully functional though, as there seems to be some sort of confusion in your patch.

Thanks! I don't have the device here with me right now. I can try the patch in an hour or two !

Quoted 3 lines

You're calling build_named_mixer_unit_ctl() with your loop variable "in_ch", but you ignore that value in the called function. That can't be intentional, can it?

No, this isn't intentional. I wrote this in September, so I don't remember completely. But a glimpse at the code reveals that this is inherited from build_mixer_unit_ctl() which doesn't use the in_pin parameter either.

Back then I wanted both functions to be as closely related as possible, with the perspective to put them on a common base or let build_mixer_unit_ctl() actually call build_named_mixer_unit_ctl(). Most probably I later confused the in_pin parameter's (non-)meaning.

Quoted 3 lines

Anyway, very little tweaking should be needed now to make this work, and if you send me back the modified patch, I'll split the work and post a patch set here.

I'll send all the needed corrections.

Regards,

Felix

#15 lore raw
In reply to Daniel Mack

Hi Daniel,

if I haven't missed anything, snd_maudio_ftu_create_ctl() will not be called since snd_usb_create_mixer() will not be called on this device.

Regards,

Felix

Am 19.05.2011 13:05, schrieb Daniel Mack:

Quoted 1 line

Attached is a patch which should show how this could work.

#16 lore raw
In reply to Daniel Mack

One more note:

You call snd_usb_create_mixer(mixer->chip, 0, 0) from snd_maudio_ftu_create_mixer() to create standard mixers first. There are no standard mixers on this device.

Regards,

Felix

#17 lore raw
Quoted 5 lines · Felix Homann

One more note:

You call snd_usb_create_mixer(mixer->chip, 0, 0) from snd_maudio_ftu_create_mixer() to create standard mixers first. There are no standard mixers on this device.

Ah, fail. Ok, try this one.

Daniel

sound/usb/card.c +1 -0
index a90662a..e7d1e0d 100644
@@ -48,6 +48,7 @@
 #include <linux/usb/audio.h>
 #include <linux/usb/audio-v2.h>
 
+#include <sound/control.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/pcm.h>
sound/usb/mixer.c +14 -20
index eab06ed..3184d77 100644
@@ -86,16 +86,6 @@ struct mixer_build {
 	const struct usbmix_selector_map *selector_map;
 };
 
-enum {
-	USB_MIXER_BOOLEAN,
-	USB_MIXER_INV_BOOLEAN,
-	USB_MIXER_S8,
-	USB_MIXER_U8,
-	USB_MIXER_S16,
-	USB_MIXER_U16,
-};
-
-
 /*E-mu 0202/0404/0204 eXtension Unit(XU) control*/
 enum {
 	USB_XU_CLOCK_RATE 		= 0xe301,
@@ -535,20 +525,21 @@ static int check_matrix_bitmap(unsigned char *bmap, int ich, int och, int num_ou
  * if failed, give up and free the control instance.
  */
 
-static int add_control_to_empty(struct mixer_build *state, struct snd_kcontrol *kctl)
+int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
+			      struct snd_kcontrol *kctl)
 {
 	struct usb_mixer_elem_info *cval = kctl->private_data;
 	int err;
 
-	while (snd_ctl_find_id(state->chip->card, &kctl->id))
+	while (snd_ctl_find_id(mixer->chip->card, &kctl->id))
 		kctl->id.index++;
-	if ((err = snd_ctl_add(state->chip->card, kctl)) < 0) {
+	if ((err = snd_ctl_add(mixer->chip->card, kctl)) < 0) {
 		snd_printd(KERN_ERR "cannot add control (err = %d)\n", err);
 		return err;
 	}
 	cval->elem_id = &kctl->id;
-	cval->next_id_elem = state->mixer->id_elems[cval->id];
-	state->mixer->id_elems[cval->id] = cval;
+	cval->next_id_elem = mixer->id_elems[cval->id];
+	mixer->id_elems[cval->id] = cval;
 	return 0;
 }
 
@@ -967,7 +958,7 @@ static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 	return changed;
 }
 
-static struct snd_kcontrol_new usb_feature_unit_ctl = {
+struct snd_kcontrol_new usb_feature_unit_ctl = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.name = "", /* will be filled later manually */
 	.info = mixer_ctl_feature_info,
@@ -984,6 +975,9 @@ static struct snd_kcontrol_new usb_feature_unit_ctl_ro = {
 	.put = NULL,
 };
 
+/* This symbol is exported in order to allow the mixer quirks to
+ * hook up to the standard feature unit control mechanism */
+struct snd_kcontrol_new *snd_usb_feature_unit_ctl = &usb_feature_unit_ctl;
 
 /*
  * build a feature control
@@ -1176,7 +1170,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
 
 	snd_printdd(KERN_INFO "[%d] FU [%s] ch = %d, val = %d/%d/%d\n",
 		    cval->id, kctl->id.name, cval->channels, cval->min, cval->max, cval->res);
-	add_control_to_empty(state, kctl);
+	snd_usb_mixer_add_control(state->mixer, kctl);
 }
 
 
@@ -1340,7 +1334,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state,
 
 	snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n",
 		    cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
-	add_control_to_empty(state, kctl);
+	snd_usb_mixer_add_control(state->mixer, kctl);
 }
 
 
@@ -1641,7 +1635,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
 
 		snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n",
 			    cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
-		if ((err = add_control_to_empty(state, kctl)) < 0)
+		if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
 			return err;
 	}
 	return 0;
@@ -1858,7 +1852,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
 
 	snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n",
 		    cval->id, kctl->id.name, desc->bNrInPins);
-	if ((err = add_control_to_empty(state, kctl)) < 0)
+	if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
 		return err;
 
 	return 0;
sound/usb/mixer.h +13 -1
index b4a2c81..ae1a14d 100644
@@ -24,7 +24,16 @@ struct usb_mixer_interface {
 	u8 xonar_u1_status;
 };
 
-#define MAX_CHANNELS	10	/* max logical channels */
+#define MAX_CHANNELS	16	/* max logical channels */
+
+enum {
+	USB_MIXER_BOOLEAN,
+	USB_MIXER_INV_BOOLEAN,
+	USB_MIXER_S8,
+	USB_MIXER_U8,
+	USB_MIXER_S16,
+	USB_MIXER_U16,
+};
 
 struct usb_mixer_elem_info {
 	struct usb_mixer_interface *mixer;
@@ -55,4 +64,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
 void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer);
 int snd_usb_mixer_activate(struct usb_mixer_interface *mixer);
 
+int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
+			      struct snd_kcontrol *kctl);
+
 #endif /* __USBMIXER_H */
sound/usb/mixer_quirks.c +70 -0

88 lines not on this page · raw message

sound/usb/quirks-table.h +2 -2
index 78792a8..0b2ae8e 100644
@@ -1988,7 +1988,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 		.data = & (const struct snd_usb_audio_quirk[]) {
 			{
 				.ifnum = 0,
-				.type = QUIRK_IGNORE_INTERFACE
+				.type = QUIRK_AUDIO_STANDARD_MIXER,
 			},
 			{
 				.ifnum = 1,
@@ -2055,7 +2055,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 		.data = & (const struct snd_usb_audio_quirk[]) {
 			{
 				.ifnum = 0,
-				.type = QUIRK_IGNORE_INTERFACE
+				.type = QUIRK_AUDIO_STANDARD_MIXER,
 			},
 			{
 				.ifnum = 1,
sound/usb/quirks.c +18 -1
index bd13d72..a31a5c4 100644
@@ -19,6 +19,7 @@
 #include <linux/usb.h>
 #include <linux/usb/audio.h>
 
+#include <sound/control.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/pcm.h>
@@ -58,6 +59,7 @@ static int create_composite_quirk(struct snd_usb_audio *chip,
 		if (quirk->ifnum != probed_ifnum)
 			usb_driver_claim_interface(driver, iface, (void *)-1L);
 	}
+
 	return 0;
 }
 
@@ -263,6 +265,20 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
 }
 
 /*
+ * Create a standard mixer for the specified interface.
+ */
+static int create_standard_mixer_quirk(struct snd_usb_audio *chip,
+				       struct usb_interface *iface,
+				       struct usb_driver *driver,
+				       const struct snd_usb_audio_quirk *quirk)
+{
+	if (quirk->ifnum < 0)
+		return 0;
+
+	return snd_usb_create_mixer(chip, quirk->ifnum, 0);
+}
+
+/*
  * audio-interface quirks
  *
  * returns zero if no standard audio/MIDI parsing is needed.
@@ -294,7 +310,8 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
 		[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
 		[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
 		[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
-		[QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk
+		[QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk,
+		[QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
 	};
 
 	if (quirk->type < QUIRK_TYPE_COUNT) {
sound/usb/usbaudio.h +1 -0
index 32f2a97..1e79986 100644
@@ -84,6 +84,7 @@ enum quirk_type {
 	QUIRK_AUDIO_FIXED_ENDPOINT,
 	QUIRK_AUDIO_EDIROL_UAXX,
 	QUIRK_AUDIO_ALIGN_TRANSFER,
+	QUIRK_AUDIO_STANDARD_MIXER,
 
 	QUIRK_TYPE_COUNT
 };
#18 lore raw

Am 19.05.2011 16:12, schrieb Daniel Mack:

Quoted 5 lines

Ah, fail. Ok, try this one.

Daniel

Hmm, this one crashes:

4104.824184] Modules linked in: snd_usb_audio(+) snd_usbmidi_lib
snd_hrtimer binfmt_misc parport_pc ppdev dm_crypt vesafb snd_hda_codec_hdmi snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_seq_midi snd_hwdep snd_rawmidi snd_pcm snd_seq_midi_event snd_seq snd_timer snd_seq_device fglrx(P) dcdbas snd psmouse soundcore serio_raw snd_page_alloc lp parport usbhid hid usb_storage firewire_ohci uas firewire_core crc_itu_t e1000e

[ 4104.824220]
[ 4104.824223] Pid: 3406, comm: modprobe Tainted: P            
2.6.38-8-generic #42-Ubuntu Dell Inc.                 Dell 
DM061                   /0WG864
[ 4104.824231] RIP: 0010:[<ffffffffa04b0119>]  [<ffffffffa04b0119>] 
snd_usb_mixer_controls+0x49/0x1a0 [snd_usb_audio]
[ 4104.824241] RSP: 0018:ffff88005eb3fb38  EFLAGS: 00010246
[ 4104.824243] RAX: 00000000041e3000 RBX: 0000000000000000 RCX: 
0000000000000000
[ 4104.824246] RDX: ffff88008fcdbc28 RSI: 0000000000000000 RDI: 
ffff88005eb3fba0
[ 4104.824249] RBP: ffff88005eb3fbc8 R08: 0000000000000005 R09: 
ffff88008315b028
[ 4104.824251] R10: ffff88009b39acc8 R11: 0000000000016e50 R12: 
ffff88005eb3fb38
[ 4104.824254] R13: ffff8800922449e8 R14: 0000000000000000 R15: 
0000000000000000
[ 4104.824258] FS:  00007f5c64217720(0000) GS:ffff8800bfc00000(0000) 
knlGS:0000000000000000
[ 4104.824261] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 4104.824263] CR2: 0000000000000020 CR3: 00000000652b5000 CR4: 
00000000000006f0
[ 4104.824266] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[ 4104.824269] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 
0000000000000400
[ 4104.824272] Process modprobe (pid: 3406, threadinfo ffff88005eb3e000, 
task ffff88005d1116e0)
[ 4104.824274] Stack:
[ 4104.824276]  ffff88008fcdbc28 ffff8800922449e8 0000000000000000 
0000000000000000
[ 4104.824281]  0000000000000000 0000000000000000 0000000000000000 
0000000000000000
[ 4104.824286]  0000000000000000 0000000000000000 0000000000000000 
0000000000000000
[ 4104.824291] Call Trace:
[ 4104.824303]  [<ffffffffa03dd1b7>] ? snd_hidden_kzalloc+0x37/0x50 [snd]
[ 4104.824312]  [<ffffffffa04b065a>] snd_usb_create_mixer+0xba/0x2a0 
[snd_usb_audio]
[ 4104.824318]  [<ffffffffa03dd1b7>] ? snd_hidden_kzalloc+0x37/0x50 [snd]
[ 4104.824327]  [<ffffffffa04b1dce>] 
create_standard_mixer_quirk+0x1e/0x20 [snd_usb_audio]
[ 4104.824335]  [<ffffffffa04b228d>] snd_usb_create_quirk+0x1d/0x50 
[snd_usb_audio]
[ 4104.824344]  [<ffffffffa04b233e>] create_composite_quirk+0x7e/0xd0 
[snd_usb_audio]
[ 4104.824353]  [<ffffffffa04b228d>] snd_usb_create_quirk+0x1d/0x50 
[snd_usb_audio]
[ 4104.824360]  [<ffffffffa04ac686>] usb_audio_probe+0x146/0x8d0 
[snd_usb_audio]
[ 4104.824368]  [<ffffffff8143e439>] usb_probe_interface+0x109/0x200
[ 4104.824373]  [<ffffffff813ba858>] really_probe+0x68/0x190
[ 4104.824377]  [<ffffffff813bab65>] driver_probe_device+0x45/0x70
[ 4104.824381]  [<ffffffff813bac3b>] __driver_attach+0xab/0xb0
[ 4104.824385]  [<ffffffff813bab90>] ? __driver_attach+0x0/0xb0
[ 4104.824389]  [<ffffffff813b99de>] bus_for_each_dev+0x5e/0x90
[ 4104.824393]  [<ffffffff813ba6ae>] driver_attach+0x1e/0x20
[ 4104.824396]  [<ffffffff813ba215>] bus_add_driver+0xc5/0x280
[ 4104.824400]  [<ffffffff813baed6>] driver_register+0x76/0x140
[ 4104.824405]  [<ffffffff815c6e2d>] ? notifier_call_chain+0x4d/0x70
[ 4104.824409]  [<ffffffff8143d008>] usb_register_driver+0xb8/0x170
[ 4104.824417]  [<ffffffffa04cc000>] ? snd_usb_audio_init+0x0/0x1000 
[snd_usb_audio]
[ 4104.824424]  [<ffffffffa04cc040>] snd_usb_audio_init+0x40/0x1000 
[snd_usb_audio]
[ 4104.824429]  [<ffffffff81002175>] do_one_initcall+0x45/0x190
[ 4104.824435]  [<ffffffff810a4feb>] sys_init_module+0xfb/0x250
[ 4104.824439]  [<ffffffff8100c002>] system_call_fastpath+0x16/0x1b
[ 4104.824442] Code: 4c 8d a5 70 ff ff ff 49 89 fd 4c 89 e7 48 8b 9a a0 
00 00 00 f3 48 ab 48 89 95 70 ff ff ff 4c 89 ad 78 ff ff ff 8b 05 07 0c 
01 00 <48> 8b 7b 20 8b 73 28 85 c0 48 89 7d 80 89 75 88 74 27 8b 4a 20
[ 4104.824482] RIP  [<ffffffffa04b0119>] 
snd_usb_mixer_controls+0x49/0x1a0 [snd_usb_audio]
[ 4104.824491]  RSP <ffff88005eb3fb38>
[ 4104.824493] CR2: 0000000000000020
[ 4104.824497] ---[ end trace b721d79c7e9b68a1 ]---
#19 lore raw
Quoted 3 lines · Felix Homann

Hmm, this one crashes:

 4104.824184] Modules linked in: snd_usb_audio(+) snd_usbmidi_lib

Could you send the first lines of the crash log, too?

Daniel

#20 lore raw
In reply to Felix Homann

Sorry, here are the first lines:

[ 4104.510080] usb 1-3: new high speed USB device using ehci_hcd and 
address 2
[ 4104.661745] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint 
0x7 has invalid maxpacket 8
[ 4104.661750] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint 
0x87 has invalid maxpacket 8
[ 4104.824137] BUG: unable to handle kernel NULL pointer dereference at 
0000000000000020
[ 4104.824147] IP: [<ffffffffa04b0119>] 
snd_usb_mixer_controls+0x49/0x1a0 [snd_usb_audio]
[ 4104.824170] PGD 652ba067 PUD 652d7067 PMD 0
[ 4104.824176] Oops: 0000 [#1] SMP
[ 4104.824179] last sysfs file: /sys/module/snd_pcm/initstate
[ 4104.824183] CPU 0

Am 20.05.2011 12:12, schrieb Felix Homann:

Quoted 98 lines

Am 19.05.2011 16:12, schrieb Daniel Mack:

Quoted 4 lines

Ah, fail. Ok, try this one.

Daniel

Hmm, this one crashes:

   4104.824184] Modules linked in: snd_usb_audio(+) snd_usbmidi_lib

snd_hrtimer binfmt_misc parport_pc ppdev dm_crypt vesafb snd_hda_codec_hdmi snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_seq_midi snd_hwdep snd_rawmidi snd_pcm snd_seq_midi_event snd_seq snd_timer snd_seq_device fglrx(P) dcdbas snd psmouse soundcore serio_raw snd_page_alloc lp parport usbhid hid usb_storage firewire_ohci uas firewire_core crc_itu_t e1000e

[ 4104.824220]
[ 4104.824223] Pid: 3406, comm: modprobe Tainted: P
2.6.38-8-generic #42-Ubuntu Dell Inc.                 Dell
DM061                   /0WG864
[ 4104.824231] RIP: 0010:[<ffffffffa04b0119>]  [<ffffffffa04b0119>]
snd_usb_mixer_controls+0x49/0x1a0 [snd_usb_audio]
[ 4104.824241] RSP: 0018:ffff88005eb3fb38  EFLAGS: 00010246
[ 4104.824243] RAX: 00000000041e3000 RBX: 0000000000000000 RCX:
0000000000000000
[ 4104.824246] RDX: ffff88008fcdbc28 RSI: 0000000000000000 RDI:
ffff88005eb3fba0
[ 4104.824249] RBP: ffff88005eb3fbc8 R08: 0000000000000005 R09:
ffff88008315b028
[ 4104.824251] R10: ffff88009b39acc8 R11: 0000000000016e50 R12:
ffff88005eb3fb38
[ 4104.824254] R13: ffff8800922449e8 R14: 0000000000000000 R15:
0000000000000000
[ 4104.824258] FS:  00007f5c64217720(0000) GS:ffff8800bfc00000(0000)
knlGS:0000000000000000
[ 4104.824261] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 4104.824263] CR2: 0000000000000020 CR3: 00000000652b5000 CR4:
00000000000006f0
[ 4104.824266] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[ 4104.824269] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7:
0000000000000400
[ 4104.824272] Process modprobe (pid: 3406, threadinfo ffff88005eb3e000,
task ffff88005d1116e0)
[ 4104.824274] Stack:
[ 4104.824276]  ffff88008fcdbc28 ffff8800922449e8 0000000000000000
0000000000000000
[ 4104.824281]  0000000000000000 0000000000000000 0000000000000000
0000000000000000
[ 4104.824286]  0000000000000000 0000000000000000 0000000000000000
0000000000000000
[ 4104.824291] Call Trace:
[ 4104.824303]  [<ffffffffa03dd1b7>] ? snd_hidden_kzalloc+0x37/0x50 [snd]
[ 4104.824312]  [<ffffffffa04b065a>] snd_usb_create_mixer+0xba/0x2a0
[snd_usb_audio]
[ 4104.824318]  [<ffffffffa03dd1b7>] ? snd_hidden_kzalloc+0x37/0x50 [snd]
[ 4104.824327]  [<ffffffffa04b1dce>]
create_standard_mixer_quirk+0x1e/0x20 [snd_usb_audio]
[ 4104.824335]  [<ffffffffa04b228d>] snd_usb_create_quirk+0x1d/0x50
[snd_usb_audio]
[ 4104.824344]  [<ffffffffa04b233e>] create_composite_quirk+0x7e/0xd0
[snd_usb_audio]
[ 4104.824353]  [<ffffffffa04b228d>] snd_usb_create_quirk+0x1d/0x50
[snd_usb_audio]
[ 4104.824360]  [<ffffffffa04ac686>] usb_audio_probe+0x146/0x8d0
[snd_usb_audio]
[ 4104.824368]  [<ffffffff8143e439>] usb_probe_interface+0x109/0x200
[ 4104.824373]  [<ffffffff813ba858>] really_probe+0x68/0x190
[ 4104.824377]  [<ffffffff813bab65>] driver_probe_device+0x45/0x70
[ 4104.824381]  [<ffffffff813bac3b>] __driver_attach+0xab/0xb0
[ 4104.824385]  [<ffffffff813bab90>] ? __driver_attach+0x0/0xb0
[ 4104.824389]  [<ffffffff813b99de>] bus_for_each_dev+0x5e/0x90
[ 4104.824393]  [<ffffffff813ba6ae>] driver_attach+0x1e/0x20
[ 4104.824396]  [<ffffffff813ba215>] bus_add_driver+0xc5/0x280
[ 4104.824400]  [<ffffffff813baed6>] driver_register+0x76/0x140
[ 4104.824405]  [<ffffffff815c6e2d>] ? notifier_call_chain+0x4d/0x70
[ 4104.824409]  [<ffffffff8143d008>] usb_register_driver+0xb8/0x170
[ 4104.824417]  [<ffffffffa04cc000>] ? snd_usb_audio_init+0x0/0x1000
[snd_usb_audio]
[ 4104.824424]  [<ffffffffa04cc040>] snd_usb_audio_init+0x40/0x1000
[snd_usb_audio]
[ 4104.824429]  [<ffffffff81002175>] do_one_initcall+0x45/0x190
[ 4104.824435]  [<ffffffff810a4feb>] sys_init_module+0xfb/0x250
[ 4104.824439]  [<ffffffff8100c002>] system_call_fastpath+0x16/0x1b
[ 4104.824442] Code: 4c 8d a5 70 ff ff ff 49 89 fd 4c 89 e7 48 8b 9a a0
00 00 00 f3 48 ab 48 89 95 70 ff ff ff 4c 89 ad 78 ff ff ff 8b 05 07 0c
01 00<48>  8b 7b 20 8b 73 28 85 c0 48 89 7d 80 89 75 88 74 27 8b 4a 20
[ 4104.824482] RIP  [<ffffffffa04b0119>]
snd_usb_mixer_controls+0x49/0x1a0 [snd_usb_audio]
[ 4104.824491]  RSP<ffff88005eb3fb38>
[ 4104.824493] CR2: 0000000000000020
[ 4104.824497] ---[ end trace b721d79c7e9b68a1 ]---

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#21 lore raw
Quoted 11 lines · Felix Homann

Sorry, here are the first lines:

[ 4104.510080] usb 1-3: new high speed USB device using ehci_hcd and address
2
[ 4104.661745] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint 0x7
has invalid maxpacket 8
[ 4104.661750] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint 0x87
has invalid maxpacket 8
[ 4104.824137] BUG: unable to handle kernel NULL pointer dereference at
0000000000000020
[ 4104.824147] IP: [<ffffffffa04b0119>] snd_usb_mixer_controls+0x49/0x1a0
Quoted 1 line

[snd_usb_audio]

Ok, chip->ctrl_intf needs to be initialized. Next try ...

Daniel

sound/usb/card.c +9 -8
index a90662a..220c616 100644
@@ -48,6 +48,7 @@
 #include <linux/usb/audio.h>
 #include <linux/usb/audio-v2.h>
 
+#include <sound/control.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/pcm.h>
@@ -492,14 +493,6 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
 		}
 	}
 
-	chip->txfr_quirk = 0;
-	err = 1; /* continue */
-	if (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {
-		/* need some special handlings */
-		if ((err = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk)) < 0)
-			goto __error;
-	}
-
 	/*
 	 * For devices with more than one control interface, we assume the
 	 * first contains the audio controls. We might need a more specific
@@ -508,6 +501,14 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
 	if (!chip->ctrl_intf)
 		chip->ctrl_intf = alts;
 
+	chip->txfr_quirk = 0;
+	err = 1; /* continue */
+	if (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {
+		/* need some special handlings */
+		if ((err = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk)) < 0)
+			goto __error;
+	}
+
 	if (err > 0) {
 		/* create normal USB audio interfaces */
 		if (snd_usb_create_streams(chip, ifnum) < 0 ||
sound/usb/mixer.c +15 -21
index eab06ed..7c07bc2 100644
@@ -86,16 +86,6 @@ struct mixer_build {
 	const struct usbmix_selector_map *selector_map;
 };
 
-enum {
-	USB_MIXER_BOOLEAN,
-	USB_MIXER_INV_BOOLEAN,
-	USB_MIXER_S8,
-	USB_MIXER_U8,
-	USB_MIXER_S16,
-	USB_MIXER_U16,
-};
-
-
 /*E-mu 0202/0404/0204 eXtension Unit(XU) control*/
 enum {
 	USB_XU_CLOCK_RATE 		= 0xe301,
@@ -535,20 +525,21 @@ static int check_matrix_bitmap(unsigned char *bmap, int ich, int och, int num_ou
  * if failed, give up and free the control instance.
  */
 
-static int add_control_to_empty(struct mixer_build *state, struct snd_kcontrol *kctl)
+int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
+			      struct snd_kcontrol *kctl)
 {
 	struct usb_mixer_elem_info *cval = kctl->private_data;
 	int err;
 
-	while (snd_ctl_find_id(state->chip->card, &kctl->id))
+	while (snd_ctl_find_id(mixer->chip->card, &kctl->id))
 		kctl->id.index++;
-	if ((err = snd_ctl_add(state->chip->card, kctl)) < 0) {
+	if ((err = snd_ctl_add(mixer->chip->card, kctl)) < 0) {
 		snd_printd(KERN_ERR "cannot add control (err = %d)\n", err);
 		return err;
 	}
 	cval->elem_id = &kctl->id;
-	cval->next_id_elem = state->mixer->id_elems[cval->id];
-	state->mixer->id_elems[cval->id] = cval;
+	cval->next_id_elem = mixer->id_elems[cval->id];
+	mixer->id_elems[cval->id] = cval;
 	return 0;
 }
 
@@ -967,7 +958,7 @@ static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 	return changed;
 }
 
-static struct snd_kcontrol_new usb_feature_unit_ctl = {
+struct snd_kcontrol_new usb_feature_unit_ctl = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.name = "", /* will be filled later manually */
 	.info = mixer_ctl_feature_info,
@@ -984,6 +975,9 @@ static struct snd_kcontrol_new usb_feature_unit_ctl_ro = {
 	.put = NULL,
 };
 
+/* This symbol is exported in order to allow the mixer quirks to
+ * hook up to the standard feature unit control mechanism */
+struct snd_kcontrol_new *snd_usb_feature_unit_ctl = &usb_feature_unit_ctl;
 
 /*
  * build a feature control
@@ -1176,7 +1170,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
 
 	snd_printdd(KERN_INFO "[%d] FU [%s] ch = %d, val = %d/%d/%d\n",
 		    cval->id, kctl->id.name, cval->channels, cval->min, cval->max, cval->res);
-	add_control_to_empty(state, kctl);
+	snd_usb_mixer_add_control(state->mixer, kctl);
 }
 
 
@@ -1340,7 +1334,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state,
 
 	snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n",
 		    cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
-	add_control_to_empty(state, kctl);
+	snd_usb_mixer_add_control(state->mixer, kctl);
 }
 
 
@@ -1641,7 +1635,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
 
 		snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n",
 			    cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
-		if ((err = add_control_to_empty(state, kctl)) < 0)
+		if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
 			return err;
 	}
 	return 0;
@@ -1858,7 +1852,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
 
 	snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n",
 		    cval->id, kctl->id.name, desc->bNrInPins);
-	if ((err = add_control_to_empty(state, kctl)) < 0)
+	if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
 		return err;
 
 	return 0;
@@ -1935,7 +1929,7 @@ static int snd_usb_mixer_dev_free(struct snd_device *device)
  *
  * walk through all UAC_OUTPUT_TERMINAL descriptors to search for mixers
  */
-static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
+int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
 {
 	struct mixer_build state;
 	int err;
sound/usb/mixer.h +13 -1
index b4a2c81..ae1a14d 100644
@@ -24,7 +24,16 @@ struct usb_mixer_interface {
 	u8 xonar_u1_status;
 };
 
-#define MAX_CHANNELS	10	/* max logical channels */
+#define MAX_CHANNELS	16	/* max logical channels */
+
+enum {
+	USB_MIXER_BOOLEAN,
+	USB_MIXER_INV_BOOLEAN,
+	USB_MIXER_S8,
+	USB_MIXER_U8,
+	USB_MIXER_S16,
+	USB_MIXER_U16,
+};
 
 struct usb_mixer_elem_info {
 	struct usb_mixer_interface *mixer;
@@ -55,4 +64,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
 void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer);
 int snd_usb_mixer_activate(struct usb_mixer_interface *mixer);
 
+int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
+			      struct snd_kcontrol *kctl);
+
 #endif /* __USBMIXER_H */
sound/usb/mixer_quirks.c +70 -0

88 lines not on this page · raw message

sound/usb/quirks-table.h +2 -2
index 78792a8..0b2ae8e 100644
@@ -1988,7 +1988,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 		.data = & (const struct snd_usb_audio_quirk[]) {
 			{
 				.ifnum = 0,
-				.type = QUIRK_IGNORE_INTERFACE
+				.type = QUIRK_AUDIO_STANDARD_MIXER,
 			},
 			{
 				.ifnum = 1,
@@ -2055,7 +2055,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 		.data = & (const struct snd_usb_audio_quirk[]) {
 			{
 				.ifnum = 0,
-				.type = QUIRK_IGNORE_INTERFACE
+				.type = QUIRK_AUDIO_STANDARD_MIXER,
 			},
 			{
 				.ifnum = 1,
sound/usb/quirks.c +18 -1
index bd13d72..a31a5c4 100644
@@ -19,6 +19,7 @@
 #include <linux/usb.h>
 #include <linux/usb/audio.h>
 
+#include <sound/control.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/pcm.h>
@@ -58,6 +59,7 @@ static int create_composite_quirk(struct snd_usb_audio *chip,
 		if (quirk->ifnum != probed_ifnum)
 			usb_driver_claim_interface(driver, iface, (void *)-1L);
 	}
+
 	return 0;
 }
 
@@ -263,6 +265,20 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
 }
 
 /*
+ * Create a standard mixer for the specified interface.
+ */
+static int create_standard_mixer_quirk(struct snd_usb_audio *chip,
+				       struct usb_interface *iface,
+				       struct usb_driver *driver,
+				       const struct snd_usb_audio_quirk *quirk)
+{
+	if (quirk->ifnum < 0)
+		return 0;
+
+	return snd_usb_create_mixer(chip, quirk->ifnum, 0);
+}
+
+/*
  * audio-interface quirks
  *
  * returns zero if no standard audio/MIDI parsing is needed.
@@ -294,7 +310,8 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
 		[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
 		[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
 		[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
-		[QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk
+		[QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk,
+		[QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
 	};
 
 	if (quirk->type < QUIRK_TYPE_COUNT) {
sound/usb/usbaudio.h +1 -0
index 32f2a97..1e79986 100644
@@ -84,6 +84,7 @@ enum quirk_type {
 	QUIRK_AUDIO_FIXED_ENDPOINT,
 	QUIRK_AUDIO_EDIROL_UAXX,
 	QUIRK_AUDIO_ALIGN_TRANSFER,
+	QUIRK_AUDIO_STANDARD_MIXER,
 
 	QUIRK_TYPE_COUNT
 };
#22 lore raw

so this works.. (ie compiles and I get controls that do change volumes of things )

I think there's something whacky with the control map. (I can't seem to send Ain5 to out 1 and 2 successfully. but I'll test this with felix's original code.

The Ain's are not capture volumes for this device.

There's 8 "analog ins" and 8 "software returns" (pcm channels) that are mixed to 8 outputs. all the input gain controls are physical or line +4db level balanced

Grant.

Quoted 24 lines · Daniel Mack
Quoted 3 lines · Felix Homann

Sorry, here are the first lines:

[ 4104.510080] usb 1-3: new high speed USB device using ehci_hcd and

address

Quoted 2 lines

2

[ 4104.661745] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint

0x7

Quoted 2 lines

has invalid maxpacket 8

[ 4104.661750] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint

0x87

Quoted 4 lines

has invalid maxpacket 8

[ 4104.824137] BUG: unable to handle kernel NULL pointer dereference at
0000000000000020
[ 4104.824147] IP: [<ffffffffa04b0119>]

snd_usb_mixer_controls+0x49/0x1a0

Quoted 1 line

[snd_usb_audio]

Ok, chip->ctrl_intf needs to be initialized. Next try ...

Daniel

#23 lore raw

So something is very whacky with the control map. not sure how to debug this.

The original patch felix posted works as I expect this one doesn't where should I start debugging this?

Grant.

Quoted 45 lines · Grant Diffey

so this works.. (ie compiles and I get controls that do change volumes of things )

I think there's something whacky with the control map. (I can't seem to send Ain5 to out 1 and 2 successfully. but I'll test this with felix's original code.

The Ain's are not capture volumes for this device.

There's 8 "analog ins" and 8 "software returns" (pcm channels) that are mixed to 8 outputs. all the input gain controls are physical or line +4db level balanced

Grant.

Quoted 24 lines · Daniel Mack
Quoted 3 lines · Felix Homann

Sorry, here are the first lines:

[ 4104.510080] usb 1-3: new high speed USB device using ehci_hcd and

address

Quoted 2 lines

2

[ 4104.661745] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint

0x7

Quoted 2 lines

has invalid maxpacket 8

[ 4104.661750] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint

0x87

Quoted 4 lines

has invalid maxpacket 8

[ 4104.824137] BUG: unable to handle kernel NULL pointer dereference at
0000000000000020
[ 4104.824147] IP: [<ffffffffa04b0119>]

snd_usb_mixer_controls+0x49/0x1a0

Quoted 1 line

[snd_usb_audio]

Ok, chip->ctrl_intf needs to be initialized. Next try ...

Daniel

#24 lore raw

I'm not close to my FTU at the moment. So I can't test it myself. Could you try interchanging chn and n in the calls of snd_maudio_ftu_create_ctl(mixer, n, chn, name) in snd_maudio_ftu_create_mixer().

--Felix

Am 20.05.2011 17:43, schrieb Grant Diffey:

Quoted 59 lines

So something is very whacky with the control map. not sure how to debug this.

The original patch felix posted works as I expect this one doesn't where should I start debugging this?

Grant.

Quoted 13 lines · Grant Diffey

so this works.. (ie compiles and I get controls that do change volumes of things )

I think there's something whacky with the control map. (I can't seem to send Ain5 to out 1 and 2 successfully. but I'll test this with felix's original code.

The Ain's are not capture volumes for this device.

There's 8 "analog ins" and 8 "software returns" (pcm channels) that are mixed to 8 outputs. all the input gain controls are physical or line +4db level balanced

Quoted 30 lines

Grant.

Quoted 23 lines · Daniel Mack
Quoted 3 lines · Felix Homann

Sorry, here are the first lines:

[ 4104.510080] usb 1-3: new high speed USB device using ehci_hcd and

address

Quoted 2 lines

2

[ 4104.661745] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint

0x7

Quoted 2 lines

has invalid maxpacket 8

[ 4104.661750] usb 1-3: config 1 interface 3 altsetting 0 bulk endpoint

0x87

Quoted 4 lines

has invalid maxpacket 8

[ 4104.824137] BUG: unable to handle kernel NULL pointer dereference at
0000000000000020
[ 4104.824147] IP: [<ffffffffa04b0119>]

snd_usb_mixer_controls+0x49/0x1a0

Quoted 1 line

[snd_usb_audio]

Ok, chip->ctrl_intf needs to be initialized. Next try ...

Daniel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#25 lore raw
In reply to Grant Diffey
Quoted 5 lines · Grant Diffey

So something is very whacky with the control map. not sure how to debug this.

The original patch felix posted works as I expect this one doesn't where should I start debugging this?

The first thing would be to define what you refer to with the term "wacky" :)

Does it fail creating the controls? Don't the control do what they're supposed to? Is the behaviour deterministic?

An easy way to track things in the driver is to add printk(KERN_WARNING ...); lines in the driver, then compile, unloaded and load the module again. Then find these lines in your syslog.

Daniel

#26 lore raw

So the controls are created as expected and do something but not everything I expect.

So my test setup here.
is inputs on analog 1, 2 and 5 if I mute all the controls. that works.

but in no setting of the controls can I get channel 5 to output to 1 and 2. setting Ain5 -Out1 and Ain5-out2 does this on the earlier patch.

so even with all the controls at 100% (this should pass every input to every output simultaneously I can't hear the input on ch5 on the headphones.

I'm going to have to look at this tomorrow it's 2:30am here. night guys

Grant

Quoted 19 lines · Daniel Mack
Quoted 5 lines · Grant Diffey

So something is very whacky with the control map. not sure how to debug this.

The original patch felix posted works as I expect this one doesn't where should I start debugging this?

The first thing would be to define what you refer to with the term "wacky" :)

Does it fail creating the controls? Don't the control do what they're supposed to? Is the behaviour deterministic?

An easy way to track things in the driver is to add printk(KERN_WARNING ...); lines in the driver, then compile, unloaded and load the module again. Then find these lines in your syslog.

Daniel

#27 lore raw
Quoted 11 lines · Grant Diffey

So the controls are created as expected and do something but not everything I expect.

So my test setup here.
is inputs on analog 1, 2 and 5  if I mute all the controls. that works.

but in no setting of the controls can I get channel 5 to output to 1 and 2. setting Ain5 -Out1 and Ain5-out2 does this on the earlier patch.

so even with all the controls at 100% (this should pass every input to every output simultaneously I can't hear the input on ch5 on the headphones.

Ok, that sound like Felix can fix this as he wrote the original patch. Maybe something in my transition went wrong, but it's just much easier to figure out what's wrong with access to the hardware :)

Daniel

#28 lore raw

Hi all,

Am 20.05.2011 18:38, schrieb Daniel Mack:

Quoted 4 lines

Ok, that sound like Felix can fix this as he wrote the original patch. Maybe something in my transition went wrong, but it's just much easier to figure out what's wrong with access to the hardware :)

Yes, I guess that will be relatively easy to find. But please, don't expect anything before Monday.

Happy weekend,

Felix

#29 lore raw

I guess I found it, but can't verify at the moment:

chn should run from 1 to 16 in the for loop. If youo can't wait till Monday, please compare the for loop in Daniel's path with mine.

Again, have a nice weekend,

Felix

#30 lore raw
In reply to Grant Diffey

Hi again,

Am 20.05.2011 17:08, schrieb Grant Diffey:

Quoted 3 lines

I think there's something whacky with the control map. (I can't seem to send Ain5 to out 1 and 2 successfully. but I'll test this with felix's original code.

Grant, could you please try the attached patch. I haven't tested all 128 controls but it seems to work fine here. And while you're at it, could you please try some other "outs" as well. My FTU is in a rack and I can't easily access out 5-8.

Quoted 4 lines

The Ain's are not capture volumes for this device
There's 8 "analog ins" and 8 "software returns" (pcm channels) that are mixed to 8 outputs. all the input gain controls are physical or line +4db level balanced

That's true. I abused the term "Capture Volume" for my purely personal interest, since it made navigating through the controls easier in alsamixer and alsamixer-qt4. So, Daniel and Takashi, please feel free to change the names to whatever you think is more appropriate.

Kind regards,

Felix

sound/usb/card.c +9 -8
index 40722f8..4edf3bc 100644
@@ -47,6 +47,7 @@
 #include <linux/usb/audio.h>
 #include <linux/usb/audio-v2.h>
 
+#include <sound/control.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/pcm.h>
@@ -478,14 +479,6 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
 		}
 	}
 
-	chip->txfr_quirk = 0;
-	err = 1; /* continue */
-	if (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {
-		/* need some special handlings */
-		if ((err = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk)) < 0)
-			goto __error;
-	}
-
 	/*
 	 * For devices with more than one control interface, we assume the
 	 * first contains the audio controls. We might need a more specific
@@ -494,6 +487,14 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
 	if (!chip->ctrl_intf)
 		chip->ctrl_intf = alts;
 
+	chip->txfr_quirk = 0;
+	err = 1; /* continue */
+	if (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) {
+		/* need some special handlings */
+		if ((err = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk)) < 0)
+			goto __error;
+	}
+
 	if (err > 0) {
 		/* create normal USB audio interfaces */
 		if (snd_usb_create_streams(chip, ifnum) < 0 ||
sound/usb/mixer.c +15 -21
index 5e47757..fbcf02f 100644
@@ -86,16 +86,6 @@ struct mixer_build {
 	const struct usbmix_selector_map *selector_map;
 };
 
-enum {
-	USB_MIXER_BOOLEAN,
-	USB_MIXER_INV_BOOLEAN,
-	USB_MIXER_S8,
-	USB_MIXER_U8,
-	USB_MIXER_S16,
-	USB_MIXER_U16,
-};
-
-
 /*E-mu 0202/0404/0204 eXtension Unit(XU) control*/
 enum {
 	USB_XU_CLOCK_RATE 		= 0xe301,
@@ -535,20 +525,21 @@ static int check_matrix_bitmap(unsigned char *bmap, int ich, int och, int num_ou
  * if failed, give up and free the control instance.
  */
 
-static int add_control_to_empty(struct mixer_build *state, struct snd_kcontrol *kctl)
+int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
+			      struct snd_kcontrol *kctl)
 {
 	struct usb_mixer_elem_info *cval = kctl->private_data;
 	int err;
 
-	while (snd_ctl_find_id(state->chip->card, &kctl->id))
+	while (snd_ctl_find_id(mixer->chip->card, &kctl->id))
 		kctl->id.index++;
-	if ((err = snd_ctl_add(state->chip->card, kctl)) < 0) {
+	if ((err = snd_ctl_add(mixer->chip->card, kctl)) < 0) {
 		snd_printd(KERN_ERR "cannot add control (err = %d)\n", err);
 		return err;
 	}
 	cval->elem_id = &kctl->id;
-	cval->next_id_elem = state->mixer->id_elems[cval->id];
-	state->mixer->id_elems[cval->id] = cval;
+	cval->next_id_elem = mixer->id_elems[cval->id];
+	mixer->id_elems[cval->id] = cval;
 	return 0;
 }
 
@@ -967,7 +958,7 @@ static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
 	return changed;
 }
 
-static struct snd_kcontrol_new usb_feature_unit_ctl = {
+struct snd_kcontrol_new usb_feature_unit_ctl = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.name = "", /* will be filled later manually */
 	.info = mixer_ctl_feature_info,
@@ -984,6 +975,9 @@ static struct snd_kcontrol_new usb_feature_unit_ctl_ro = {
 	.put = NULL,
 };
 
+/* This symbol is exported in order to allow the mixer quirks to
+ * hook up to the standard feature unit control mechanism */
+struct snd_kcontrol_new *snd_usb_feature_unit_ctl = &usb_feature_unit_ctl;
 
 /*
  * build a feature control
@@ -1174,7 +1168,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
 
 	snd_printdd(KERN_INFO "[%d] FU [%s] ch = %d, val = %d/%d/%d\n",
 		    cval->id, kctl->id.name, cval->channels, cval->min, cval->max, cval->res);
-	add_control_to_empty(state, kctl);
+	snd_usb_mixer_add_control(state->mixer, kctl);
 }
 
 
@@ -1338,7 +1332,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state,
 
 	snd_printdd(KERN_INFO "[%d] MU [%s] ch = %d, val = %d/%d\n",
 		    cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
-	add_control_to_empty(state, kctl);
+	snd_usb_mixer_add_control(state->mixer, kctl);
 }
 
 
@@ -1639,7 +1633,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
 
 		snd_printdd(KERN_INFO "[%d] PU [%s] ch = %d, val = %d/%d\n",
 			    cval->id, kctl->id.name, cval->channels, cval->min, cval->max);
-		if ((err = add_control_to_empty(state, kctl)) < 0)
+		if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
 			return err;
 	}
 	return 0;
@@ -1856,7 +1850,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
 
 	snd_printdd(KERN_INFO "[%d] SU [%s] items = %d\n",
 		    cval->id, kctl->id.name, desc->bNrInPins);
-	if ((err = add_control_to_empty(state, kctl)) < 0)
+	if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0)
 		return err;
 
 	return 0;
@@ -1933,7 +1927,7 @@ static int snd_usb_mixer_dev_free(struct snd_device *device)
  *
  * walk through all UAC_OUTPUT_TERMINAL descriptors to search for mixers
  */
-static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
+int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
 {
 	struct mixer_build state;
 	int err;
sound/usb/mixer.h +13 -1
index b4a2c81..ae1a14d 100644
@@ -24,7 +24,16 @@ struct usb_mixer_interface {
 	u8 xonar_u1_status;
 };
 
-#define MAX_CHANNELS	10	/* max logical channels */
+#define MAX_CHANNELS	16	/* max logical channels */
+
+enum {
+	USB_MIXER_BOOLEAN,
+	USB_MIXER_INV_BOOLEAN,
+	USB_MIXER_S8,
+	USB_MIXER_U8,
+	USB_MIXER_S16,
+	USB_MIXER_U16,
+};
 
 struct usb_mixer_elem_info {
 	struct usb_mixer_interface *mixer;
@@ -55,4 +64,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
 void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer);
 int snd_usb_mixer_activate(struct usb_mixer_interface *mixer);
 
+int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
+			      struct snd_kcontrol *kctl);
+
 #endif /* __USBMIXER_H */
sound/usb/mixer_quirks.c +70 -0

88 lines not on this page · raw message

sound/usb/quirks-table.h +2 -2
index 196c753..f0ad7f1 100644
@@ -1935,7 +1935,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 		.data = & (const struct snd_usb_audio_quirk[]) {
 			{
 				.ifnum = 0,
-				.type = QUIRK_IGNORE_INTERFACE
+				.type = QUIRK_AUDIO_STANDARD_MIXER,
 			},
 			{
 				.ifnum = 1,
@@ -2002,7 +2002,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 		.data = & (const struct snd_usb_audio_quirk[]) {
 			{
 				.ifnum = 0,
-				.type = QUIRK_IGNORE_INTERFACE
+				.type = QUIRK_AUDIO_STANDARD_MIXER,
 			},
 			{
 				.ifnum = 1,
sound/usb/quirks.c +18 -1
index 355759b..193e499 100644
@@ -19,6 +19,7 @@
 #include <linux/usb.h>
 #include <linux/usb/audio.h>
 
+#include <sound/control.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/pcm.h>
@@ -58,6 +59,7 @@ static int create_composite_quirk(struct snd_usb_audio *chip,
 		if (quirk->ifnum != probed_ifnum)
 			usb_driver_claim_interface(driver, iface, (void *)-1L);
 	}
+
 	return 0;
 }
 
@@ -263,6 +265,20 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
 }
 
 /*
+ * Create a standard mixer for the specified interface.
+ */
+static int create_standard_mixer_quirk(struct snd_usb_audio *chip,
+				       struct usb_interface *iface,
+				       struct usb_driver *driver,
+				       const struct snd_usb_audio_quirk *quirk)
+{
+	if (quirk->ifnum < 0)
+		return 0;
+
+	return snd_usb_create_mixer(chip, quirk->ifnum, 0);
+}
+
+/*
  * audio-interface quirks
  *
  * returns zero if no standard audio/MIDI parsing is needed.
@@ -294,7 +310,8 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
 		[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
 		[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
 		[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
-		[QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk
+		[QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk,
+		[QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
 	};
 
 	if (quirk->type < QUIRK_TYPE_COUNT) {
sound/usb/usbaudio.h +1 -0
index 32f2a97..1e79986 100644
@@ -84,6 +84,7 @@ enum quirk_type {
 	QUIRK_AUDIO_FIXED_ENDPOINT,
 	QUIRK_AUDIO_EDIROL_UAXX,
 	QUIRK_AUDIO_ALIGN_TRANSFER,
+	QUIRK_AUDIO_STANDARD_MIXER,
 
 	QUIRK_TYPE_COUNT
 };
#31 lore raw
Quoted 9 lines · Felix Homann

Hi again,

Am 20.05.2011 17:08, schrieb Grant Diffey:

Quoted 5 lines

I think there's something whacky with the control map. (I can't seem to send
Ain5 to out 1 and 2 successfully. but I'll test this with felix's original code.

Quoted 4 lines

Grant, could you please try the attached patch. I haven't tested all 128 controls but it seems to work fine here. And while you're at it, could you please try some other "outs" as well. My FTU is in a rack and I can't easily access out 5-8.

Good. I already amended and split the patch into pieces and can send out the whole thing once you give me a go.

Daniel

#32 lore raw

At Tue, 24 May 2011 12:47:31 +0200,

Quoted 11 lines · Daniel Mack
Quoted 9 lines · Felix Homann

Hi again,

Am 20.05.2011 17:08, schrieb Grant Diffey:

Quoted 5 lines

I think there's something whacky with the control map. (I can't seem to send
Ain5 to out 1 and 2 successfully. but I'll test this with felix's original code.

Quoted 7 lines
Quoted 4 lines

Grant, could you please try the attached patch. I haven't tested all 128 controls but it seems to work fine here. And while you're at it, could you please try some other "outs" as well. My FTU is in a rack and I can't easily access out 5-8.

Good. I already amended and split the patch into pieces and can send out the whole thing once you give me a go.

For putting the stuff into 2.6.40, please submit it until tomorrow, so that I can send a pull request in time. Linus announced that 2.6.40 has a shorter merge window.

thanks,

Takashi

#33 lore raw
In reply to Felix Homann

Guys,

So I'm not going to get to this for ~10hrs which means missing the merge window nost likely for 2.6.40/2.8.0/3.0/whateverlinusdecidestocallit I'm comefortable with Felix having tested. I will get to it when I can but I'm currently @work and will be for 8hrs or so.

Grant.

Quoted 36 lines · Felix Homann

Hi again,

Am 20.05.2011 17:08, schrieb Grant Diffey:

I think there's something whacky with the control map. (I can't seem to

Quoted 4 lines

send
Ain5 to out 1 and 2 successfully. but I'll test this with felix's original code.

Grant, could you please try the attached patch. I haven't tested all 128 controls but it seems to work fine here. And while you're at it, could you please try some other "outs" as well. My FTU is in a rack and I can't easily access out 5-8.

The Ain's are not capture volumes for this device

Quoted 4 lines

There's 8 "analog ins" and 8 "software returns" (pcm channels) that are mixed to 8 outputs. all the input gain controls are physical or line +4db level balanced

That's true. I abused the term "Capture Volume" for my purely personal interest, since it made navigating through the controls easier in alsamixer and alsamixer-qt4. So, Daniel and Takashi, please feel free to change the names to whatever you think is more appropriate.

Kind regards,

Felix