Skip to contentSkip to conversation

mixer: simple - Fix "Capture Volume" and "Capture Switch" being seen as global controls

PATCH Applied Hans de Goede 2 participants 2 messages May 4, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mixer: simple - Fix "Capture Volume" and "Capture Switch" being seen as global controls

Fix the "Capture Volume" and "Capture Switch" exceptions no longer working after commit 86b9c67774bc ("mixer: simple - Unify simple_none:
base_len() exception handling") because they were moved to after the suffix checking, so they would be treated as CTL_GLOBAL_VOLUME resp. CTL_GLOBAL_SWITCH based on their suffix before the exception check has a chance to check for a match.

---
 src/mixer/simple_none.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
src/mixer/simple_none.c +10 -10
index 71d88486..9b9f0000 100644
@@ -913,6 +913,16 @@ static int base_len(const char *name, selem_ctl_type_t *type)
 	const struct suf *p;
 	size_t nlen = strlen(name);
 
+	/* exception: "Capture Volume" and "Capture Switch" */
+	if (!strcmp(name, "Capture Volume")) {
+		*type = CTL_CAPTURE_VOLUME;
+		return strlen("Capture");
+	}
+	if (!strcmp(name, "Capture Switch")) {
+		*type = CTL_CAPTURE_SWITCH;
+		return strlen("Capture");
+	}
+
 	for (p = suffixes; p->suffix; p++) {
 		size_t slen = strlen(p->suffix);
 		size_t l;
@@ -926,16 +936,6 @@ static int base_len(const char *name, selem_ctl_type_t *type)
 		}
 	}
 
-	/* exception: "Capture Volume" and "Capture Switch" */
-	if (!strcmp(name, "Capture Volume")) {
-		*type = CTL_CAPTURE_VOLUME;
-		return strlen("Capture");
-	}
-	if (!strcmp(name, "Capture Switch")) {
-		*type = CTL_CAPTURE_SWITCH;
-		return strlen("Capture");
-	}
-
 	/* Special case - handle "Input Source" as a capture route.
 	 * Note that it's *NO* capture source.  A capture source is split over
 	 * sub-elements, and multiple capture-sources will result in an error.
Signature · 1 line
2.31.1
#1 lore raw

Dne 04. 05. 21 v 17:58 Hans de Goede napsal(a):

Quoted 8 lines

Fix the "Capture Volume" and "Capture Switch" exceptions no longer working after commit 86b9c67774bc ("mixer: simple - Unify simple_none:
base_len() exception handling") because they were moved to after the suffix checking, so they would be treated as CTL_GLOBAL_VOLUME resp. CTL_GLOBAL_SWITCH based on their suffix before the exception check has a chance to check for a match.

Applied. Thank you.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.