[alsa-devel] focusrite scarlett 18i20 : Mixer controls with corrupted names for

Takashi Iwai tiwai at suse.de
Tue Jun 25 09:54:08 CEST 2019


On Sat, 22 Jun 2019 22:55:25 +0200,
Stefan Sauer wrote:
> 
> So the first 8 controls are added somewhere else. Looks like this is from
> mixer.c and after
> echo -n 'file sound/usb/mixer.c +p' >/sys/kernel/debug/dynamic_debug/control
> I get
> [ 4405.855432] usb 1-2: [51] PU [KKKKKKKKKKKKKÃÃÃÃÃÃÃÃÃÃÃ Switch] ch = 1, val = 0/1
> [ 4405.856423] usb 1-2: [52] PU [ Switch] ch = 1, val = 0/1

This indicates that these weird names come from the two extension
units id 51 and 52.
Could you put some debug print in build_audio_procunit() like below?


thanks,

Takashi

--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2358,8 +2358,10 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
 	for (info = list; info && info->type; info++)
 		if (info->type == type)
 			break;
-	if (!info || !info->type)
+	if (!info || !info->type) {
+		pr_info("XXX unit %d to default_info\n", unitid);
 		info = &default_info;
+	}
 
 	for (valinfo = info->values; valinfo->control; valinfo++) {
 		__u8 *controls = uac_processing_unit_bmControls(desc, state->mixer->protocol);
@@ -2375,8 +2377,11 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
 		}
 
 		map = find_map(state->map, unitid, valinfo->control);
+		if (map)
+			pr_info("XXX map found for unit %d\n", unitid);
 		if (check_ignored_ctl(map))
 			continue;
+
 		cval = kzalloc(sizeof(*cval), GFP_KERNEL);
 		if (!cval)
 			return -ENOMEM;
@@ -2444,19 +2449,26 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
 		kctl->private_free = snd_usb_mixer_elem_free;
 
 		if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name))) {
+			pr_info("XXX name copied from map: '%s' for unit %d\n", kctl->id.name, unitid);
 			/* nothing */ ;
 		} else if (info->name) {
 			strlcpy(kctl->id.name, info->name, sizeof(kctl->id.name));
+			pr_info("XXX name copied from info: '%s' for unit %d\n", kctl->id.name, unitid);
 		} else {
 			nameid = uac_processing_unit_iProcessing(desc, state->mixer->protocol);
+			pr_info("XXX nameid=%d, unit %d\n", nameid, unitid);
 			len = 0;
-			if (nameid)
+			if (nameid) {
 				len = snd_usb_copy_string_desc(state->chip,
 							       nameid,
 							       kctl->id.name,
 							       sizeof(kctl->id.name));
-			if (!len)
+				pr_info("XXX copy string desc '%s'\n", kctl->id.name);
+			}
+			if (!len) {
 				strlcpy(kctl->id.name, name, sizeof(kctl->id.name));
+				pr_info("XXX copy default name '%s'\n", kctl->id.name);
+			}
 		}
 		append_ctl_name(kctl, " ");
 		append_ctl_name(kctl, valinfo->suffix);


More information about the Alsa-devel mailing list