diff options
Diffstat (limited to 'source/l/alsa-lib/0e4ba2ea8c0402f12a645032a14693eb9b1278e6.patch')
-rw-r--r-- | source/l/alsa-lib/0e4ba2ea8c0402f12a645032a14693eb9b1278e6.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/source/l/alsa-lib/0e4ba2ea8c0402f12a645032a14693eb9b1278e6.patch b/source/l/alsa-lib/0e4ba2ea8c0402f12a645032a14693eb9b1278e6.patch new file mode 100644 index 00000000..3703f809 --- /dev/null +++ b/source/l/alsa-lib/0e4ba2ea8c0402f12a645032a14693eb9b1278e6.patch @@ -0,0 +1,65 @@ +From 0e4ba2ea8c0402f12a645032a14693eb9b1278e6 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela <perex@perex.cz> +Date: Wed, 2 Jun 2021 11:09:43 +0200 +Subject: [PATCH] ucm: add _alibpref to get the private device prefix + +It may be useful to get the device prefix for the local configuration. + +Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1251 +Signed-off-by: Jaroslav Kysela <perex@perex.cz> +--- + include/use-case.h | 1 + + src/ucm/main.c | 21 +++++++++++++++++++++ + 2 files changed, 22 insertions(+) + +diff --git a/include/use-case.h b/include/use-case.h +index ec1a97b0..7890358b 100644 +--- a/include/use-case.h ++++ b/include/use-case.h +@@ -258,6 +258,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, + * - _verb - return current verb + * - _file - return configuration file loaded for current card + * - _alibcfg - return private alsa-lib's configuration for current card ++ * - _alibpref - return private alsa-lib's configuration device prefix for current card + * + * - [=]{NAME}[/[{modifier}|{/device}][/{verb}]] + * - value identifier {NAME} +diff --git a/src/ucm/main.c b/src/ucm/main.c +index 361952f6..3c9ea15d 100644 +--- a/src/ucm/main.c ++++ b/src/ucm/main.c +@@ -2138,6 +2138,25 @@ static int get_alibcfg(snd_use_case_mgr_t *uc_mgr, char **str) + return 0; + } + ++/** ++ * \brief Get device prefix for private alsa-lib configuration ++ * \param uc_mgr Use case manager ++ * \param str Returned value string ++ * \return Zero on success (value is filled), otherwise a negative error code ++ */ ++static int get_alibpref(snd_use_case_mgr_t *uc_mgr, char **str) ++{ ++ const size_t l = 9; ++ char *s; ++ ++ s = malloc(l); ++ if (s == NULL) ++ return -ENOMEM; ++ snprintf(s, l, "_ucm%04X", uc_mgr->ucm_card_number); ++ *str = s; ++ return 0; ++} ++ + /** + * \brief Get current - string + * \param uc_mgr Use case manager +@@ -2193,6 +2212,8 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, + + } else if (strcmp(identifier, "_alibcfg") == 0) { + err = get_alibcfg(uc_mgr, (char **)value); ++ } else if (strcmp(identifier, "_alibpref") == 0) { ++ err = get_alibpref(uc_mgr, (char **)value); + } else if (identifier[0] == '_') { + err = -ENOENT; + } else { |