summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2022-06-29 17:01:32 +0200
committerJaroslav Kysela <perex@perex.cz>2022-06-29 17:03:46 +0200
commiteb870fcba9f1d3d9e4d0823012ff04ac2bea00ca (patch)
treee20e8323ba33b377d32f1036abf69e2f79679652
parent5dd411190deb1957a7ed86f284e4f7a0c58bb877 (diff)
downloadpulseaudio-eb870fcba9f1d3d9e4d0823012ff04ac2bea00ca.tar.gz
alsa-ucm: remove extra space from the device.intended_roles property
Before: device.intended_roles = " voice" After: device.intended_roles = "voice" Signed-off-by: Jaroslav Kysela <perex@perex.cz> Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/731>
-rw-r--r--src/modules/alsa/alsa-ucm.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index ba9840451..e75756f53 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -730,7 +730,7 @@ static void add_media_role(pa_alsa_ucm_device *dev, const char *role_name, const
}
static char *modifier_name_to_role(const char *mod_name, bool *is_sink) {
- char *sub = NULL, *tmp;
+ char *sub = NULL, *tmp, *pos;
*is_sink = false;
@@ -740,19 +740,24 @@ static char *modifier_name_to_role(const char *mod_name, bool *is_sink) {
} else if (pa_startswith(mod_name, "Capture"))
sub = pa_xstrdup(mod_name + 7);
- if (!sub || !*sub) {
+ pos = sub;
+ while (pos && *pos == ' ') pos++;
+
+ if (!pos || !*pos) {
pa_xfree(sub);
pa_log_warn("Can't match media roles for modifier %s", mod_name);
return NULL;
}
- tmp = sub;
+ tmp = pos;
do {
*tmp = tolower(*tmp);
} while (*(++tmp));
- return sub;
+ tmp = pa_xstrdup(pos);
+ pa_xfree(sub);
+ return tmp;
}
static void ucm_set_media_roles(pa_alsa_ucm_modifier *modifier, const char *mod_name) {