|
|
b64678 |
From c79f09e1f5e8b559b58dacdb00708d995b2e3aa5 Mon Sep 17 00:00:00 2001
|
|
|
b64678 |
From: paulhsia <paulhsia@chromium.org>
|
|
|
b64678 |
Date: Sat, 30 Nov 2019 03:35:30 +0800
|
|
|
b64678 |
Subject: [PATCH 01/16] ucm: Use strncmp to avoid access-out-of-boundary
|
|
|
02270a |
|
|
|
b64678 |
If the length of the identifier is less than the length of the prefix,
|
|
|
b64678 |
access-out-of-boundary will occur in memcmp().
|
|
|
02270a |
|
|
|
b64678 |
Signed-off-by: paulhsia <paulhsia@chromium.org>
|
|
|
b64678 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
src/ucm/main.c | 8 +++++---
|
|
|
b64678 |
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/src/ucm/main.c b/src/ucm/main.c
|
|
|
b64678 |
index b0b6ffb3..252e50d9 100644
|
|
|
b64678 |
--- a/src/ucm/main.c
|
|
|
b64678 |
+++ b/src/ucm/main.c
|
|
|
b64678 |
@@ -61,11 +61,13 @@ static int check_identifier(const char *identifier, const char *prefix)
|
|
|
02270a |
{
|
|
|
b64678 |
int len;
|
|
|
02270a |
|
|
|
b64678 |
- if (strcmp(identifier, prefix) == 0)
|
|
|
b64678 |
- return 1;
|
|
|
b64678 |
len = strlen(prefix);
|
|
|
b64678 |
- if (memcmp(identifier, prefix, len) == 0 && identifier[len] == '/')
|
|
|
b64678 |
+ if (strncmp(identifier, prefix, len) != 0)
|
|
|
b64678 |
+ return 0;
|
|
|
02270a |
+
|
|
|
b64678 |
+ if (identifier[len] == 0 || identifier[len] == '/')
|
|
|
b64678 |
return 1;
|
|
|
02270a |
+
|
|
|
02270a |
return 0;
|
|
|
02270a |
}
|
|
|
02270a |
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From 9baf64da2f26844434ecea4825052937a3abe06c Mon Sep 17 00:00:00 2001
|
|
|
b64678 |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Fri, 29 Nov 2019 22:28:26 +0100
|
|
|
b64678 |
Subject: [PATCH 02/16] ucm: return always at least NULL if no list is
|
|
|
b64678 |
available in snd_use_case_get_list()
|
|
|
02270a |
|
|
|
b64678 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
src/ucm/main.c | 8 ++++++--
|
|
|
b64678 |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/src/ucm/main.c b/src/ucm/main.c
|
|
|
b64678 |
index 252e50d9..b80db65f 100644
|
|
|
b64678 |
--- a/src/ucm/main.c
|
|
|
b64678 |
+++ b/src/ucm/main.c
|
|
|
b64678 |
@@ -1160,8 +1160,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
|
|
|
b64678 |
modifier = find_modifier(uc_mgr, verb, name, 0);
|
|
|
b64678 |
if (modifier) {
|
|
|
b64678 |
- if (modifier->dev_list.type != type)
|
|
|
b64678 |
+ if (modifier->dev_list.type != type) {
|
|
|
b64678 |
+ *list = NULL;
|
|
|
b64678 |
return 0;
|
|
|
b64678 |
+ }
|
|
|
b64678 |
return get_list(&modifier->dev_list.list, list,
|
|
|
b64678 |
struct dev_list_node, list,
|
|
|
b64678 |
name);
|
|
|
b64678 |
@@ -1169,8 +1171,10 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
|
|
|
b64678 |
device = find_device(uc_mgr, verb, name, 0);
|
|
|
b64678 |
if (device) {
|
|
|
b64678 |
- if (device->dev_list.type != type)
|
|
|
b64678 |
+ if (device->dev_list.type != type) {
|
|
|
b64678 |
+ *list = NULL;
|
|
|
b64678 |
return 0;
|
|
|
b64678 |
+ }
|
|
|
b64678 |
return get_list(&device->dev_list.list, list,
|
|
|
b64678 |
struct dev_list_node, list,
|
|
|
b64678 |
name);
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From ebdd2b6cdb8119cf75f0dd0a3b283d271b3a547e Mon Sep 17 00:00:00 2001
|
|
|
b64678 |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Sat, 30 Nov 2019 20:31:55 +0100
|
|
|
b64678 |
Subject: [PATCH 03/16] ucm: add _identifiers list
|
|
|
02270a |
|
|
|
b64678 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
include/use-case.h | 1 +
|
|
|
b64678 |
src/ucm/main.c | 268 ++++++++++++++++++++++++++++++++++-----------
|
|
|
b64678 |
2 files changed, 208 insertions(+), 61 deletions(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/include/use-case.h b/include/use-case.h
|
|
|
b64678 |
index 8e7e838c..85c58ac0 100644
|
|
|
b64678 |
--- a/include/use-case.h
|
|
|
b64678 |
+++ b/include/use-case.h
|
|
|
b64678 |
@@ -206,6 +206,7 @@ int snd_use_case_free_list(const char *list[], int items);
|
|
|
b64678 |
* - _enadevs - get list of enabled devices
|
|
|
b64678 |
* - _enamods - get list of enabled modifiers
|
|
|
b64678 |
*
|
|
|
b64678 |
+ * - _identifiers/{modifier}|{device}[/{verb}] - list of value identifiers
|
|
|
b64678 |
* - _supporteddevs/{modifier}|{device}[/{verb}] - list of supported devices
|
|
|
b64678 |
* - _conflictingdevs/{modifier}|{device}[/{verb}] - list of conflicting devices
|
|
|
b64678 |
*
|
|
|
b64678 |
diff --git a/src/ucm/main.c b/src/ucm/main.c
|
|
|
b64678 |
index b80db65f..d2078a23 100644
|
|
|
b64678 |
--- a/src/ucm/main.c
|
|
|
b64678 |
+++ b/src/ucm/main.c
|
|
|
b64678 |
@@ -1072,7 +1072,6 @@ int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr)
|
|
|
b64678 |
/**
|
|
|
b64678 |
* \brief Get list of verbs in pair verbname+comment
|
|
|
b64678 |
* \param list Returned list
|
|
|
b64678 |
- * \param verbname For verb (NULL = current)
|
|
|
b64678 |
* \return Number of list entries if success, otherwise a negative error code
|
|
|
b64678 |
*/
|
|
|
b64678 |
static int get_verb_list(snd_use_case_mgr_t *uc_mgr, const char **list[])
|
|
|
b64678 |
@@ -1181,7 +1180,6 @@ static int get_supcon_device_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
}
|
|
|
02270a |
|
|
|
b64678 |
return -ENOENT;
|
|
|
b64678 |
-
|
|
|
b64678 |
}
|
|
|
02270a |
|
|
|
b64678 |
/**
|
|
|
b64678 |
@@ -1210,41 +1208,201 @@ static int get_conflicting_device_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
|
|
|
b64678 |
#ifndef DOC_HIDDEN
|
|
|
b64678 |
struct myvalue {
|
|
|
b64678 |
- struct list_head list;
|
|
|
b64678 |
- char *value;
|
|
|
b64678 |
+ struct list_head list;
|
|
|
b64678 |
+ const char *text;
|
|
|
b64678 |
};
|
|
|
b64678 |
#endif
|
|
|
02270a |
|
|
|
b64678 |
+/**
|
|
|
b64678 |
+ * \brief Convert myvalue list string list
|
|
|
b64678 |
+ * \param list myvalue list
|
|
|
b64678 |
+ * \param res string list
|
|
|
b64678 |
+ * \retval Number of list entries if success, otherwise a negativer error code
|
|
|
b64678 |
+ */
|
|
|
b64678 |
+static int myvalue_to_str_list(struct list_head *list, char ***res)
|
|
|
b64678 |
+{
|
|
|
b64678 |
+ struct list_head *pos;
|
|
|
b64678 |
+ struct myvalue *value;
|
|
|
b64678 |
+ char **p;
|
|
|
b64678 |
+ int cnt;
|
|
|
b64678 |
+
|
|
|
b64678 |
+ cnt = alloc_str_list(list, 1, res);
|
|
|
b64678 |
+ if (cnt < 0)
|
|
|
b64678 |
+ return cnt;
|
|
|
b64678 |
+ p = *res;
|
|
|
b64678 |
+ list_for_each(pos, list) {
|
|
|
b64678 |
+ value = list_entry(pos, struct myvalue, list);
|
|
|
b64678 |
+ *p = strdup(value->text);
|
|
|
b64678 |
+ if (*p == NULL) {
|
|
|
b64678 |
+ snd_use_case_free_list((const char **)p, cnt);
|
|
|
b64678 |
+ return -ENOMEM;
|
|
|
b64678 |
+ }
|
|
|
b64678 |
+ p++;
|
|
|
02270a |
+ }
|
|
|
b64678 |
+ return cnt;
|
|
|
02270a |
+}
|
|
|
02270a |
+
|
|
|
b64678 |
+/**
|
|
|
b64678 |
+ * \brief Free myvalue list
|
|
|
b64678 |
+ * \param list myvalue list
|
|
|
b64678 |
+ */
|
|
|
b64678 |
+static void myvalue_list_free(struct list_head *list)
|
|
|
b64678 |
+{
|
|
|
b64678 |
+ struct list_head *pos, *npos;
|
|
|
b64678 |
+ struct myvalue *value;
|
|
|
02270a |
+
|
|
|
b64678 |
+ list_for_each_safe(pos, npos, list) {
|
|
|
b64678 |
+ value = list_entry(pos, struct myvalue, list);
|
|
|
b64678 |
+ list_del(&value->list);
|
|
|
b64678 |
+ free(value);
|
|
|
02270a |
+ }
|
|
|
02270a |
+}
|
|
|
02270a |
+
|
|
|
b64678 |
+/**
|
|
|
b64678 |
+ * \brief Merge one value to the myvalue list
|
|
|
b64678 |
+ * \param list The list with values
|
|
|
b64678 |
+ * \param value The value to be merged (without duplicates)
|
|
|
b64678 |
+ * \return 1 if dup, 0 if success, otherwise a negative error code
|
|
|
b64678 |
+ */
|
|
|
b64678 |
+static int merge_value(struct list_head *list, const char *text)
|
|
|
b64678 |
+{
|
|
|
b64678 |
+ struct list_head *pos;
|
|
|
b64678 |
+ struct myvalue *value;
|
|
|
02270a |
+
|
|
|
b64678 |
+ list_for_each(pos, list) {
|
|
|
b64678 |
+ value = list_entry(pos, struct myvalue, list);
|
|
|
b64678 |
+ if (strcmp(value->text, text) == 0)
|
|
|
b64678 |
+ return 1;
|
|
|
02270a |
+ }
|
|
|
b64678 |
+ value = malloc(sizeof(*value));
|
|
|
b64678 |
+ if (value == NULL)
|
|
|
b64678 |
+ return -ENOMEM;
|
|
|
b64678 |
+ value->text = text;
|
|
|
b64678 |
+ list_add_tail(&value->list, list);
|
|
|
b64678 |
+ return 0;
|
|
|
02270a |
+}
|
|
|
02270a |
+
|
|
|
b64678 |
+/**
|
|
|
b64678 |
+ * \brief Find all values for given identifier
|
|
|
b64678 |
+ * \param list Returned list
|
|
|
b64678 |
+ * \param source Source list with ucm_value structures
|
|
|
b64678 |
+ * \return Zero if success, otherwise a negative error code
|
|
|
b64678 |
+ */
|
|
|
b64678 |
+static int add_identifiers(struct list_head *list,
|
|
|
b64678 |
+ struct list_head *source)
|
|
|
b64678 |
+{
|
|
|
b64678 |
+ struct ucm_value *v;
|
|
|
b64678 |
+ struct list_head *pos;
|
|
|
b64678 |
+ int err;
|
|
|
02270a |
+
|
|
|
b64678 |
+ list_for_each(pos, source) {
|
|
|
b64678 |
+ v = list_entry(pos, struct ucm_value, list);
|
|
|
b64678 |
+ err = merge_value(list, v->name);
|
|
|
b64678 |
+ if (err < 0)
|
|
|
b64678 |
+ return err;
|
|
|
02270a |
+ }
|
|
|
b64678 |
+ return 0;
|
|
|
02270a |
+}
|
|
|
02270a |
+
|
|
|
b64678 |
+/**
|
|
|
b64678 |
+ * \brief Find all values for given identifier
|
|
|
b64678 |
+ * \param list Returned list
|
|
|
b64678 |
+ * \param identifier Identifier
|
|
|
b64678 |
+ * \param source Source list with ucm_value structures
|
|
|
b64678 |
+ */
|
|
|
b64678 |
static int add_values(struct list_head *list,
|
|
|
b64678 |
const char *identifier,
|
|
|
b64678 |
struct list_head *source)
|
|
|
b64678 |
{
|
|
|
b64678 |
- struct ucm_value *v;
|
|
|
b64678 |
- struct myvalue *val;
|
|
|
b64678 |
- struct list_head *pos, *pos1;
|
|
|
b64678 |
- int match;
|
|
|
b64678 |
+ struct ucm_value *v;
|
|
|
b64678 |
+ struct list_head *pos;
|
|
|
b64678 |
+ int err;
|
|
|
b64678 |
|
|
|
b64678 |
- list_for_each(pos, source) {
|
|
|
b64678 |
- v = list_entry(pos, struct ucm_value, list);
|
|
|
b64678 |
- if (check_identifier(identifier, v->name)) {
|
|
|
b64678 |
- match = 0;
|
|
|
b64678 |
- list_for_each(pos1, list) {
|
|
|
b64678 |
- val = list_entry(pos1, struct myvalue, list);
|
|
|
b64678 |
- if (strcmp(val->value, v->data) == 0) {
|
|
|
b64678 |
- match = 1;
|
|
|
b64678 |
- break;
|
|
|
b64678 |
- }
|
|
|
b64678 |
- }
|
|
|
b64678 |
- if (!match) {
|
|
|
b64678 |
- val = malloc(sizeof(struct myvalue));
|
|
|
b64678 |
- if (val == NULL)
|
|
|
b64678 |
- return -ENOMEM;
|
|
|
b64678 |
- val->value = v->data;
|
|
|
b64678 |
- list_add_tail(&val->list, list);
|
|
|
b64678 |
- }
|
|
|
b64678 |
- }
|
|
|
b64678 |
- }
|
|
|
b64678 |
- return 0;
|
|
|
b64678 |
+ list_for_each(pos, source) {
|
|
|
b64678 |
+ v = list_entry(pos, struct ucm_value, list);
|
|
|
b64678 |
+ if (check_identifier(identifier, v->name)) {
|
|
|
b64678 |
+ err = merge_value(list, v->data);
|
|
|
b64678 |
+ if (err < 0)
|
|
|
b64678 |
+ return err;
|
|
|
b64678 |
+ }
|
|
|
02270a |
+ }
|
|
|
b64678 |
+ return 0;
|
|
|
02270a |
+}
|
|
|
02270a |
+
|
|
|
b64678 |
+/**
|
|
|
b64678 |
+ * \brief compare two identifiers
|
|
|
b64678 |
+ */
|
|
|
b64678 |
+static int identifier_cmp(const void *_a, const void *_b)
|
|
|
02270a |
+{
|
|
|
b64678 |
+ const char * const *a = _a;
|
|
|
b64678 |
+ const char * const *b = _b;
|
|
|
b64678 |
+ return strcmp(*a, *b);
|
|
|
b64678 |
+}
|
|
|
02270a |
+
|
|
|
b64678 |
+/**
|
|
|
b64678 |
+ * \brief Get list of available identifiers
|
|
|
b64678 |
+ * \param list Returned list
|
|
|
b64678 |
+ * \param name Name of verb or modifier to query
|
|
|
b64678 |
+ * \return Number of list entries if success, otherwise a negative error code
|
|
|
b64678 |
+ */
|
|
|
b64678 |
+static int get_identifiers_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
+ const char **list[], char *name)
|
|
|
b64678 |
+{
|
|
|
b64678 |
+ struct use_case_verb *verb;
|
|
|
b64678 |
+ struct use_case_modifier *modifier;
|
|
|
b64678 |
+ struct use_case_device *device;
|
|
|
b64678 |
+ struct list_head mylist;
|
|
|
b64678 |
+ struct list_head *value_list;
|
|
|
b64678 |
+ char *str, **res;
|
|
|
b64678 |
+ int err;
|
|
|
b64678 |
+
|
|
|
b64678 |
+ if (!name)
|
|
|
b64678 |
+ return -ENOENT;
|
|
|
b64678 |
+
|
|
|
b64678 |
+ str = strchr(name, '/');
|
|
|
b64678 |
+ if (str) {
|
|
|
b64678 |
+ *str = '\0';
|
|
|
b64678 |
+ verb = find_verb(uc_mgr, str + 1);
|
|
|
b64678 |
+ }
|
|
|
b64678 |
+ else {
|
|
|
b64678 |
+ verb = uc_mgr->active_verb;
|
|
|
b64678 |
+ }
|
|
|
b64678 |
+ if (!verb)
|
|
|
b64678 |
+ return -ENOENT;
|
|
|
02270a |
+
|
|
|
b64678 |
+ value_list = NULL;
|
|
|
b64678 |
+ modifier = find_modifier(uc_mgr, verb, name, 0);
|
|
|
b64678 |
+ if (modifier) {
|
|
|
b64678 |
+ value_list = &modifier->value_list;
|
|
|
b64678 |
+ } else {
|
|
|
b64678 |
+ device = find_device(uc_mgr, verb, name, 0);
|
|
|
b64678 |
+ if (device)
|
|
|
b64678 |
+ value_list = &device->value_list;
|
|
|
b64678 |
+ }
|
|
|
b64678 |
+ if (value_list == NULL)
|
|
|
b64678 |
+ return -ENOENT;
|
|
|
02270a |
+
|
|
|
b64678 |
+ INIT_LIST_HEAD(&mylist);
|
|
|
b64678 |
+ err = add_identifiers(&mylist, &uc_mgr->value_list);
|
|
|
b64678 |
+ if (err < 0)
|
|
|
b64678 |
+ goto __fail;
|
|
|
b64678 |
+ err = add_identifiers(&mylist, &verb->value_list);
|
|
|
b64678 |
+ if (err < 0)
|
|
|
b64678 |
+ goto __fail;
|
|
|
b64678 |
+ err = add_identifiers(&mylist, value_list);
|
|
|
b64678 |
+ if (err < 0)
|
|
|
b64678 |
+ goto __fail;
|
|
|
b64678 |
+ err = myvalue_to_str_list(&mylist, &res;;
|
|
|
b64678 |
+ if (err > 0)
|
|
|
b64678 |
+ *list = (const char **)res;
|
|
|
b64678 |
+ else if (err == 0)
|
|
|
b64678 |
+ *list = NULL;
|
|
|
b64678 |
+__fail:
|
|
|
b64678 |
+ myvalue_list_free(&mylist);
|
|
|
b64678 |
+ if (err <= 0)
|
|
|
b64678 |
+ return err;
|
|
|
b64678 |
+ qsort(*list, err, sizeof(char *), identifier_cmp);
|
|
|
b64678 |
+ return err;
|
|
|
b64678 |
}
|
|
|
02270a |
|
|
|
02270a |
/**
|
|
|
b64678 |
@@ -1258,8 +1416,7 @@ static int get_value_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
const char **list[],
|
|
|
b64678 |
char *verbname)
|
|
|
02270a |
{
|
|
|
b64678 |
- struct list_head mylist, *pos, *npos;
|
|
|
b64678 |
- struct myvalue *val;
|
|
|
b64678 |
+ struct list_head mylist, *pos;
|
|
|
b64678 |
struct use_case_verb *verb;
|
|
|
b64678 |
struct use_case_device *dev;
|
|
|
b64678 |
struct use_case_modifier *mod;
|
|
|
b64678 |
@@ -1292,26 +1449,13 @@ static int get_value_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
if (err < 0)
|
|
|
b64678 |
goto __fail;
|
|
|
b64678 |
}
|
|
|
b64678 |
- err = alloc_str_list(&mylist, 1, &res;;
|
|
|
b64678 |
- if (err >= 0) {
|
|
|
b64678 |
+ err = myvalue_to_str_list(&mylist, &res;;
|
|
|
b64678 |
+ if (err > 0)
|
|
|
b64678 |
*list = (const char **)res;
|
|
|
b64678 |
- list_for_each(pos, &mylist) {
|
|
|
b64678 |
- val = list_entry(pos, struct myvalue, list);
|
|
|
b64678 |
- *res = strdup(val->value);
|
|
|
b64678 |
- if (*res == NULL) {
|
|
|
b64678 |
- snd_use_case_free_list((const char **)res, err);
|
|
|
b64678 |
- err = -ENOMEM;
|
|
|
b64678 |
- goto __fail;
|
|
|
b64678 |
- }
|
|
|
b64678 |
- res++;
|
|
|
b64678 |
- }
|
|
|
b64678 |
- }
|
|
|
b64678 |
+ else if (err == 0)
|
|
|
b64678 |
+ *list = NULL;
|
|
|
b64678 |
__fail:
|
|
|
b64678 |
- list_for_each_safe(pos, npos, &mylist) {
|
|
|
b64678 |
- val = list_entry(pos, struct myvalue, list);
|
|
|
b64678 |
- list_del(&val->list);
|
|
|
b64678 |
- free(val);
|
|
|
b64678 |
- }
|
|
|
b64678 |
+ myvalue_list_free(&mylist);
|
|
|
b64678 |
return err;
|
|
|
b64678 |
}
|
|
|
02270a |
|
|
|
b64678 |
@@ -1381,21 +1525,23 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
} else {
|
|
|
b64678 |
str = NULL;
|
|
|
b64678 |
}
|
|
|
b64678 |
- if (check_identifier(identifier, "_devices"))
|
|
|
b64678 |
- err = get_device_list(uc_mgr, list, str);
|
|
|
b64678 |
+ if (check_identifier(identifier, "_devices"))
|
|
|
b64678 |
+ err = get_device_list(uc_mgr, list, str);
|
|
|
b64678 |
else if (check_identifier(identifier, "_modifiers"))
|
|
|
b64678 |
- err = get_modifier_list(uc_mgr, list, str);
|
|
|
b64678 |
- else if (check_identifier(identifier, "_supporteddevs"))
|
|
|
b64678 |
- err = get_supported_device_list(uc_mgr, list, str);
|
|
|
b64678 |
- else if (check_identifier(identifier, "_conflictingdevs"))
|
|
|
b64678 |
- err = get_conflicting_device_list(uc_mgr, list, str);
|
|
|
b64678 |
+ err = get_modifier_list(uc_mgr, list, str);
|
|
|
b64678 |
+ else if (check_identifier(identifier, "_identifiers"))
|
|
|
b64678 |
+ err = get_identifiers_list(uc_mgr, list, str);
|
|
|
b64678 |
+ else if (check_identifier(identifier, "_supporteddevs"))
|
|
|
b64678 |
+ err = get_supported_device_list(uc_mgr, list, str);
|
|
|
b64678 |
+ else if (check_identifier(identifier, "_conflictingdevs"))
|
|
|
b64678 |
+ err = get_conflicting_device_list(uc_mgr, list, str);
|
|
|
b64678 |
else if (identifier[0] == '_')
|
|
|
b64678 |
err = -ENOENT;
|
|
|
b64678 |
- else
|
|
|
b64678 |
- err = get_value_list(uc_mgr, identifier, list, str);
|
|
|
b64678 |
- if (str)
|
|
|
b64678 |
- free(str);
|
|
|
b64678 |
- }
|
|
|
b64678 |
+ else
|
|
|
b64678 |
+ err = get_value_list(uc_mgr, identifier, list, str);
|
|
|
b64678 |
+ if (str)
|
|
|
b64678 |
+ free(str);
|
|
|
b64678 |
+ }
|
|
|
b64678 |
__end:
|
|
|
b64678 |
pthread_mutex_unlock(&uc_mgr->mutex);
|
|
|
b64678 |
return err;
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From 5ee5ef31b5ff3fb7c904054cb9cac7478a727f7c Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Sun, 1 Dec 2019 14:26:40 +0100
|
|
|
b64678 |
Subject: [PATCH 04/16] namehint: correct the @args check
|
|
|
02270a |
|
|
|
b64678 |
BugLink: https://github.com/alsa-project/alsa-plugins/issues/3
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
src/control/namehint.c | 6 ++++++
|
|
|
b64678 |
1 file changed, 6 insertions(+)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/src/control/namehint.c b/src/control/namehint.c
|
|
|
b64678 |
index 808df6b5..4927ef97 100644
|
|
|
b64678 |
--- a/src/control/namehint.c
|
|
|
b64678 |
+++ b/src/control/namehint.c
|
|
|
b64678 |
@@ -348,6 +348,12 @@ static int try_config(snd_config_t *config,
|
|
|
b64678 |
goto __cleanup;
|
|
|
b64678 |
if (snd_config_search(res, "@args", &cfg) >= 0) {
|
|
|
b64678 |
snd_config_for_each(i, next, cfg) {
|
|
|
b64678 |
+ /* skip the argument list */
|
|
|
b64678 |
+ snd_config_get_id(snd_config_iterator_entry(i), &str);
|
|
|
b64678 |
+ while (*str && *str >= '0' && *str <= '9') str++;
|
|
|
b64678 |
+ if (*str == '\0')
|
|
|
b64678 |
+ continue;
|
|
|
b64678 |
+ /* the argument definition must have the default */
|
|
|
b64678 |
if (snd_config_search(snd_config_iterator_entry(i),
|
|
|
b64678 |
"default", NULL) < 0) {
|
|
|
b64678 |
err = -EINVAL;
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From 6055f8a584296abfc0cec0439ceb708f0eddcc9d Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Sun, 1 Dec 2019 14:30:54 +0100
|
|
|
b64678 |
Subject: [PATCH 05/16] namehint: improve the previous patch (check the
|
|
|
b64678 |
returned value)
|
|
|
02270a |
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
src/control/namehint.c | 3 ++-
|
|
|
b64678 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/src/control/namehint.c b/src/control/namehint.c
|
|
|
b64678 |
index 4927ef97..60c48ae3 100644
|
|
|
b64678 |
--- a/src/control/namehint.c
|
|
|
b64678 |
+++ b/src/control/namehint.c
|
|
|
b64678 |
@@ -349,7 +349,8 @@ static int try_config(snd_config_t *config,
|
|
|
b64678 |
if (snd_config_search(res, "@args", &cfg) >= 0) {
|
|
|
b64678 |
snd_config_for_each(i, next, cfg) {
|
|
|
b64678 |
/* skip the argument list */
|
|
|
b64678 |
- snd_config_get_id(snd_config_iterator_entry(i), &str);
|
|
|
b64678 |
+ if (snd_config_get_id(snd_config_iterator_entry(i), &str) < 0)
|
|
|
b64678 |
+ continue;
|
|
|
b64678 |
while (*str && *str >= '0' && *str <= '9') str++;
|
|
|
b64678 |
if (*str == '\0')
|
|
|
b64678 |
continue;
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From 4dddcf733d56a13f4d042fefa1fb6230c09f1f65 Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Mon, 2 Dec 2019 11:56:30 +0100
|
|
|
b64678 |
Subject: [PATCH 06/16] ucm: docs - allow spaces in device names for JackHWMute
|
|
|
02270a |
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
include/use-case.h | 25 +++++++++++++------------
|
|
|
b64678 |
1 file changed, 13 insertions(+), 12 deletions(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/include/use-case.h b/include/use-case.h
|
|
|
b64678 |
index 85c58ac0..e1f58027 100644
|
|
|
b64678 |
--- a/include/use-case.h
|
|
|
b64678 |
+++ b/include/use-case.h
|
|
|
b64678 |
@@ -326,7 +326,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
* - Valid values: "soft" (software attenuation)
|
|
|
b64678 |
* - EDIDFile
|
|
|
b64678 |
* - Path to EDID file for HDMI devices
|
|
|
b64678 |
- * - JackControl, JackDev, JackHWMute
|
|
|
b64678 |
+ * - JackControl, JackDev
|
|
|
b64678 |
* - Jack information for a device. The jack status can be reported via
|
|
|
b64678 |
* a kcontrol and/or via an input device. **JackControl** is the
|
|
|
b64678 |
* kcontrol name of the jack, and **JackDev** is the input device id of
|
|
|
b64678 |
@@ -334,17 +334,18 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
* JackDev value should be "foo"). UCM configuration files should
|
|
|
b64678 |
* contain both JackControl and JackDev when possible, because
|
|
|
b64678 |
* applications are likely to support only one or the other.
|
|
|
b64678 |
- *
|
|
|
b64678 |
- * If **JackHWMute** is set, it indicates that when the jack is plugged
|
|
|
b64678 |
- * in, the hardware automatically mutes some other device(s). The
|
|
|
b64678 |
- * JackHWMute value is a space-separated list of device names (this
|
|
|
b64678 |
- * isn't compatible with device names with spaces in them, so don't use
|
|
|
b64678 |
- * such device names!). Note that JackHWMute should be used only when
|
|
|
b64678 |
- * the hardware enforces the automatic muting. If the hardware doesn't
|
|
|
b64678 |
- * enforce any muting, it may still be tempting to set JackHWMute to
|
|
|
b64678 |
- * trick upper software layers to e.g. automatically mute speakers when
|
|
|
b64678 |
- * headphones are plugged in, but that's application policy
|
|
|
b64678 |
- * configuration that doesn't belong to UCM configuration files.
|
|
|
b64678 |
+ * - JackHWMute
|
|
|
b64678 |
+ * If this value is set, it indicates that when the jack is plugged
|
|
|
b64678 |
+ * in, the hardware automatically mutes some other device(s). The
|
|
|
b64678 |
+ * value is a space-separated list of device names. If the device
|
|
|
b64678 |
+ * name contains space, it must be enclosed to ' or ", e.g.:
|
|
|
b64678 |
+ * JackHWMute "'Dock Headphone' Headphone"
|
|
|
b64678 |
+ * Note that JackHWMute should be used only when the hardware enforces
|
|
|
b64678 |
+ * the automatic muting. If the hardware doesn't enforce any muting, it
|
|
|
b64678 |
+ * may still be tempting to set JackHWMute to trick upper software layers
|
|
|
b64678 |
+ * to e.g. automatically mute speakers when headphones are plugged in,
|
|
|
b64678 |
+ * but that's application policy configuration that doesn't belong
|
|
|
b64678 |
+ * to UCM configuration files.
|
|
|
b64678 |
* - MinBufferLevel
|
|
|
b64678 |
* - This is used on platform where reported buffer level is not accurate.
|
|
|
b64678 |
* E.g. "512", which holds 512 samples in device buffer. Note: this will
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From 2a286ca9a8415571181ce58027686ec332a834e9 Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Mon, 2 Dec 2019 11:57:18 +0100
|
|
|
b64678 |
Subject: [PATCH 07/16] use-case: docs - add PlaybackMixerCopy and
|
|
|
b64678 |
CaptureMixerCopy
|
|
|
02270a |
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
include/use-case.h | 12 ++++++++++++
|
|
|
b64678 |
1 file changed, 12 insertions(+)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/include/use-case.h b/include/use-case.h
|
|
|
b64678 |
index e1f58027..71fcc949 100644
|
|
|
b64678 |
--- a/include/use-case.h
|
|
|
b64678 |
+++ b/include/use-case.h
|
|
|
b64678 |
@@ -309,8 +309,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
* - PlaybackMixerElem
|
|
|
b64678 |
* - mixer element playback identifier
|
|
|
b64678 |
* - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
+ * - PlaybackMixerCopy
|
|
|
b64678 |
+ * - additional mixer element playback identifier
|
|
|
b64678 |
+ * - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
+ * - those elements should copy the volume and switch settings
|
|
|
b64678 |
+ * - element identifiers are separated using the | character
|
|
|
b64678 |
* - PlaybackMasterElem
|
|
|
b64678 |
* - mixer element playback identifier for the master control
|
|
|
b64678 |
+ * - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
* - PlaybackMasterType
|
|
|
b64678 |
* - type of the master volume control
|
|
|
b64678 |
* - Valid values: "soft" (software attenuation)
|
|
|
b64678 |
@@ -319,8 +325,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
* - CaptureMixerElem
|
|
|
b64678 |
* - mixer element capture identifier
|
|
|
b64678 |
* - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
+ * - CaptureMixerCopy
|
|
|
b64678 |
+ * - additional mixer element capture identifier
|
|
|
b64678 |
+ * - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
+ * - those elements should copy the volume and switch settings
|
|
|
b64678 |
+ * - element identifiers are separated using the | character
|
|
|
b64678 |
* - CaptureMasterElem
|
|
|
b64678 |
* - mixer element playback identifier for the master control
|
|
|
b64678 |
+ * - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
* - CaptureMasterType
|
|
|
b64678 |
* - type of the master volume control
|
|
|
b64678 |
* - Valid values: "soft" (software attenuation)
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From a0fc4447bb7c7f9a850a0a85f3a5a32c1509caf4 Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Tue, 3 Dec 2019 15:01:04 +0100
|
|
|
b64678 |
Subject: [PATCH 08/16] ucm: docs - add JackCTL, rearrange JackControl and
|
|
|
b64678 |
JackDev
|
|
|
02270a |
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
include/use-case.h | 22 ++++++++++++++--------
|
|
|
b64678 |
1 file changed, 14 insertions(+), 8 deletions(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/include/use-case.h b/include/use-case.h
|
|
|
b64678 |
index 71fcc949..25998cb9 100644
|
|
|
b64678 |
--- a/include/use-case.h
|
|
|
b64678 |
+++ b/include/use-case.h
|
|
|
b64678 |
@@ -338,14 +338,20 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
* - Valid values: "soft" (software attenuation)
|
|
|
b64678 |
* - EDIDFile
|
|
|
b64678 |
* - Path to EDID file for HDMI devices
|
|
|
b64678 |
- * - JackControl, JackDev
|
|
|
b64678 |
- * - Jack information for a device. The jack status can be reported via
|
|
|
b64678 |
- * a kcontrol and/or via an input device. **JackControl** is the
|
|
|
b64678 |
- * kcontrol name of the jack, and **JackDev** is the input device id of
|
|
|
b64678 |
- * the jack (if the full input device path is /dev/input/by-id/foo, the
|
|
|
b64678 |
- * JackDev value should be "foo"). UCM configuration files should
|
|
|
b64678 |
- * contain both JackControl and JackDev when possible, because
|
|
|
b64678 |
- * applications are likely to support only one or the other.
|
|
|
b64678 |
+ * - JackCTL
|
|
|
b64678 |
+ * - jack control device name
|
|
|
b64678 |
+ * - JackControl
|
|
|
b64678 |
+ * - jack control identificator
|
|
|
b64678 |
+ * - can be parsed using snd_use_case_parse_ctl_elem_id()
|
|
|
b64678 |
+ * - UCM configuration files should contain both JackControl and JackDev
|
|
|
b64678 |
+ * when possible, because applications are likely to support only one
|
|
|
b64678 |
+ * or the other
|
|
|
b64678 |
+ * - JackDev
|
|
|
b64678 |
+ * - the input device id of the jack (if the full input device path is
|
|
|
b64678 |
+ * /dev/input/by-id/foo, the JackDev value should be "foo")
|
|
|
b64678 |
+ * - UCM configuration files should contain both JackControl and JackDev
|
|
|
b64678 |
+ * when possible, because applications are likely to support only one
|
|
|
b64678 |
+ * or the other
|
|
|
b64678 |
* - JackHWMute
|
|
|
b64678 |
* If this value is set, it indicates that when the jack is plugged
|
|
|
b64678 |
* in, the hardware automatically mutes some other device(s). The
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From e59034a0bec257cc7422a1e9436d936be8696a6f Mon Sep 17 00:00:00 2001
|
|
|
b64678 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
b64678 |
Date: Tue, 3 Dec 2019 18:27:39 +0100
|
|
|
b64678 |
Subject: [PATCH 09/16] ucm: Do not fail to parse configs on cards with an
|
|
|
b64678 |
empty CardComponents lists
|
|
|
02270a |
|
|
|
b64678 |
Since the UCM profiles for all Bay- and Cherry-Trail SST cards have been
|
|
|
b64678 |
moved over to UCM2, parsing them fails with:
|
|
|
02270a |
|
|
|
b64678 |
ALSA lib ucm_subs.c:220:(uc_mgr_get_substituted_value) variable '${CardComponents}' is not defined in this context!
|
|
|
02270a |
|
|
|
b64678 |
This completely breaks audio support on all Bay- and Cherry-Trail devices.
|
|
|
02270a |
|
|
|
b64678 |
This is caused by these non-SOF ASoC using cards having an empty
|
|
|
b64678 |
CardComponents list. Which in itself is fine, but is rejected by
|
|
|
b64678 |
the ucm_subs.c code. This commit changes the ucm_subs code to accept
|
|
|
b64678 |
an empty string as a valid value for CardComponents restoring audio
|
|
|
b64678 |
functionality on these boards.
|
|
|
02270a |
|
|
|
b64678 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
src/ucm/ucm_subs.c | 20 ++++++++++++--------
|
|
|
b64678 |
1 file changed, 12 insertions(+), 8 deletions(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/src/ucm/ucm_subs.c b/src/ucm/ucm_subs.c
|
|
|
b64678 |
index 00afa9e3..90e395f0 100644
|
|
|
b64678 |
--- a/src/ucm/ucm_subs.c
|
|
|
b64678 |
+++ b/src/ucm/ucm_subs.c
|
|
|
b64678 |
@@ -25,6 +25,7 @@
|
|
|
b64678 |
*/
|
|
|
02270a |
|
|
|
b64678 |
#include "ucm_local.h"
|
|
|
b64678 |
+#include <stdbool.h>
|
|
|
b64678 |
#include <sys/stat.h>
|
|
|
b64678 |
#include <limits.h>
|
|
|
02270a |
|
|
|
b64678 |
@@ -145,10 +146,11 @@ static char *rval_sysfs(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char
|
|
|
b64678 |
return strdup(path);
|
|
|
02270a |
}
|
|
|
02270a |
|
|
|
b64678 |
-#define MATCH_VARIABLE(name, id, fcn) \
|
|
|
b64678 |
+#define MATCH_VARIABLE(name, id, fcn, empty_ok) \
|
|
|
b64678 |
if (strncmp((name), (id), sizeof(id) - 1) == 0) { \
|
|
|
b64678 |
rval = fcn(uc_mgr); \
|
|
|
b64678 |
idsize = sizeof(id) - 1; \
|
|
|
b64678 |
+ allow_empty = (empty_ok); \
|
|
|
b64678 |
goto __rval; \
|
|
|
b64678 |
}
|
|
|
02270a |
|
|
|
b64678 |
@@ -189,12 +191,14 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
|
|
|
b64678 |
while (*value) {
|
|
|
b64678 |
if (*value == '$' && *(value+1) == '{') {
|
|
|
b64678 |
- MATCH_VARIABLE(value, "${ConfName}", rval_conf_name);
|
|
|
b64678 |
- MATCH_VARIABLE(value, "${CardId}", rval_card_id);
|
|
|
b64678 |
- MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver);
|
|
|
b64678 |
- MATCH_VARIABLE(value, "${CardName}", rval_card_name);
|
|
|
b64678 |
- MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname);
|
|
|
b64678 |
- MATCH_VARIABLE(value, "${CardComponents}", rval_card_components);
|
|
|
b64678 |
+ bool allow_empty = false;
|
|
|
b64678 |
+
|
|
|
b64678 |
+ MATCH_VARIABLE(value, "${ConfName}", rval_conf_name, false);
|
|
|
b64678 |
+ MATCH_VARIABLE(value, "${CardId}", rval_card_id, false);
|
|
|
b64678 |
+ MATCH_VARIABLE(value, "${CardDriver}", rval_card_driver, false);
|
|
|
b64678 |
+ MATCH_VARIABLE(value, "${CardName}", rval_card_name, false);
|
|
|
b64678 |
+ MATCH_VARIABLE(value, "${CardLongName}", rval_card_longname, false);
|
|
|
b64678 |
+ MATCH_VARIABLE(value, "${CardComponents}", rval_card_components, true);
|
|
|
b64678 |
MATCH_VARIABLE2(value, "${env:", rval_env);
|
|
|
b64678 |
MATCH_VARIABLE2(value, "${sys:", rval_sysfs);
|
|
|
b64678 |
err = -EINVAL;
|
|
|
b64678 |
@@ -208,7 +212,7 @@ int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
}
|
|
|
b64678 |
goto __error;
|
|
|
b64678 |
__rval:
|
|
|
b64678 |
- if (rval == NULL || rval[0] == '\0') {
|
|
|
b64678 |
+ if (rval == NULL || (!allow_empty && rval[0] == '\0')) {
|
|
|
b64678 |
free(rval);
|
|
|
b64678 |
strncpy(r, value, idsize);
|
|
|
b64678 |
r[idsize] = '\0';
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From 8e2c70add782f997f7c269ed3f722888e56ff024 Mon Sep 17 00:00:00 2001
|
|
|
b64678 |
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
|
|
b64678 |
Date: Tue, 3 Dec 2019 18:56:40 +0100
|
|
|
b64678 |
Subject: [PATCH 10/16] src/ucm/main.c: fix build without mixer
|
|
|
02270a |
|
|
|
b64678 |
Commit 4ce38a5ff466d18039b2606938f866ea3a6c9f3c breaks the build without
|
|
|
b64678 |
mixer on:
|
|
|
b64678 |
|
|
|
b64678 |
CCLD libasound.la
|
|
|
b64678 |
/home/buildroot/autobuild/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/8.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: ucm/.libs/libucm.a(main.o): in function `snd_use_case_set':
|
|
|
b64678 |
main.c:(.text+0x185c): undefined reference to `snd_mixer_selem_id_parse'
|
|
|
b64678 |
|
|
|
b64678 |
Fixes: http://autobuild.buildroot.org/results/4d91c9f82a2a61c50c457a851073b85cc09ea345
|
|
|
b64678 |
|
|
|
b64678 |
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
src/ucm/main.c | 2 ++
|
|
|
02270a |
1 file changed, 2 insertions(+)
|
|
|
02270a |
|
|
|
b64678 |
diff --git a/src/ucm/main.c b/src/ucm/main.c
|
|
|
b64678 |
index d2078a23..61922f10 100644
|
|
|
b64678 |
--- a/src/ucm/main.c
|
|
|
b64678 |
+++ b/src/ucm/main.c
|
|
|
b64678 |
@@ -2115,8 +2115,10 @@ int snd_use_case_parse_selem_id(snd_mixer_selem_id_t *dst,
|
|
|
b64678 |
const char *ucm_id,
|
|
|
b64678 |
const char *value)
|
|
|
b64678 |
{
|
|
|
b64678 |
+#ifdef BUILD_MIXER
|
|
|
b64678 |
if (strcmp(ucm_id, "PlaybackMixerId") == 0 ||
|
|
|
b64678 |
strcmp(ucm_id, "CaptureMixerId") == 0)
|
|
|
b64678 |
return snd_mixer_selem_id_parse(dst, value);
|
|
|
b64678 |
+#endif
|
|
|
b64678 |
return -EINVAL;
|
|
|
b64678 |
}
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From ad8527d81b09c4d0edd054b5b1468ce1c50b23cb Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Wed, 4 Dec 2019 09:49:40 +0100
|
|
|
b64678 |
Subject: [PATCH 11/16] alsa.m4: another try to fix the libatopology detection
|
|
|
02270a |
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
utils/alsa.m4 | 11 +++++++++--
|
|
|
b64678 |
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/utils/alsa.m4 b/utils/alsa.m4
|
|
|
b64678 |
index 4c457f0d..320e4336 100644
|
|
|
b64678 |
--- a/utils/alsa.m4
|
|
|
b64678 |
+++ b/utils/alsa.m4
|
|
|
b64678 |
@@ -22,6 +22,7 @@ alsa_save_CFLAGS="$CFLAGS"
|
|
|
b64678 |
alsa_save_LDFLAGS="$LDFLAGS"
|
|
|
b64678 |
alsa_save_LIBS="$LIBS"
|
|
|
b64678 |
alsa_found=yes
|
|
|
b64678 |
+alsa_topology_found=no
|
|
|
b64678 |
|
|
|
b64678 |
dnl
|
|
|
b64678 |
dnl Get the cflags and libraries for alsa
|
|
|
b64678 |
@@ -158,11 +159,17 @@ AC_CHECK_LIB([asound], [snd_ctl_open],,
|
|
|
b64678 |
alsa_found=no]
|
|
|
b64678 |
)
|
|
|
b64678 |
if test "x$enable_atopology" = "xyes"; then
|
|
|
b64678 |
+alsa_topology_found=yes
|
|
|
b64678 |
AC_CHECK_LIB([atopology], [snd_tplg_new],,
|
|
|
b64678 |
[ifelse([$3], , [AC_MSG_ERROR(No linkable libatopology was found.)])
|
|
|
b64678 |
- alsa_found=no]
|
|
|
b64678 |
+ alsa_topology_found=no,
|
|
|
b64678 |
+]
|
|
|
b64678 |
)
|
|
|
b64678 |
fi
|
|
|
b64678 |
+else
|
|
|
b64678 |
+if test "x$enable_atopology" = "xyes"; then
|
|
|
b64678 |
+ alsa_topology_found=yes
|
|
|
b64678 |
+fi
|
|
|
b64678 |
fi
|
|
|
b64678 |
|
|
|
b64678 |
if test "x$alsa_found" = "xyes" ; then
|
|
|
b64678 |
@@ -183,7 +190,7 @@ fi
|
|
|
b64678 |
|
|
|
b64678 |
dnl add the alsa topology library; must be at the end
|
|
|
b64678 |
AC_MSG_CHECKING(for ALSA topology LDFLAGS)
|
|
|
b64678 |
-if test "x$enable_atopology" = "xyes"; then
|
|
|
b64678 |
+if test "x$alsa_topology_found" = "xyes"; then
|
|
|
b64678 |
ALSA_TOPOLOGY_LIBS="$ALSA_TOPOLOGY_LIBS -latopology"
|
|
|
b64678 |
fi
|
|
|
b64678 |
AC_MSG_RESULT($ALSA_TOPOLOGY_LIBS)
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From 555a5dbdabc5ed3be1ca81865abdb997bc3a6082 Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Thu, 5 Dec 2019 16:59:05 +0100
|
|
|
b64678 |
Subject: [PATCH 12/16] ucm: docs - add Mic/DigitalMic and multiple devices
|
|
|
b64678 |
comments
|
|
|
02270a |
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
include/use-case.h | 8 ++++++++
|
|
|
b64678 |
1 file changed, 8 insertions(+)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/include/use-case.h b/include/use-case.h
|
|
|
b64678 |
index 25998cb9..1736da25 100644
|
|
|
b64678 |
--- a/include/use-case.h
|
|
|
b64678 |
+++ b/include/use-case.h
|
|
|
b64678 |
@@ -114,10 +114,18 @@ extern "C" {
|
|
|
b64678 |
*
|
|
|
b64678 |
* Physical system devices the render and capture audio. Devices can be OR'ed
|
|
|
b64678 |
* together to support audio on simultaneous devices.
|
|
|
b64678 |
+ *
|
|
|
b64678 |
+ * If multiple devices with the same name exists, the number suffixes should
|
|
|
b64678 |
+ * be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are
|
|
|
b64678 |
+ * allowed. The names with numbers must be continuous.
|
|
|
b64678 |
+ *
|
|
|
b64678 |
+ * The preference of the devices is determined by the priority value.
|
|
|
b64678 |
*/
|
|
|
b64678 |
#define SND_USE_CASE_DEV_NONE "None" /**< None Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */
|
|
|
b64678 |
+#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Analog Microphone */
|
|
|
b64678 |
+#define SND_USE_CASE_DEV_DIGITAL_MIC "DigitalMic" /**< Integrated Digital Microphone */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From 1ad660ddeecb2a364f1ca62aa60f256f7029cfdc Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Thu, 5 Dec 2019 17:01:31 +0100
|
|
|
b64678 |
Subject: [PATCH 13/16] ucm: docs - remove DigitalMic, it does not have sense
|
|
|
02270a |
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
include/use-case.h | 3 +--
|
|
|
b64678 |
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/include/use-case.h b/include/use-case.h
|
|
|
b64678 |
index 1736da25..214a2a4c 100644
|
|
|
b64678 |
--- a/include/use-case.h
|
|
|
b64678 |
+++ b/include/use-case.h
|
|
|
b64678 |
@@ -124,8 +124,7 @@ extern "C" {
|
|
|
b64678 |
#define SND_USE_CASE_DEV_NONE "None" /**< None Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */
|
|
|
b64678 |
-#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Analog Microphone */
|
|
|
b64678 |
-#define SND_USE_CASE_DEV_DIGITAL_MIC "DigitalMic" /**< Integrated Digital Microphone */
|
|
|
b64678 |
+#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Microphone */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From 5473c5d677915b88d5c93d5bcc6cd16bb6a40342 Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Thu, 5 Dec 2019 17:19:06 +0100
|
|
|
b64678 |
Subject: [PATCH 14/16] ucm: docs - change the Mic description to simple
|
|
|
b64678 |
Microphone Device
|
|
|
02270a |
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
include/use-case.h | 2 +-
|
|
|
b64678 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/include/use-case.h b/include/use-case.h
|
|
|
b64678 |
index 214a2a4c..b04f7b9d 100644
|
|
|
b64678 |
--- a/include/use-case.h
|
|
|
b64678 |
+++ b/include/use-case.h
|
|
|
b64678 |
@@ -124,7 +124,7 @@ extern "C" {
|
|
|
b64678 |
#define SND_USE_CASE_DEV_NONE "None" /**< None Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */
|
|
|
b64678 |
-#define SND_USE_CASE_DEV_MIC "Mic" /**< Integrated Microphone */
|
|
|
b64678 |
+#define SND_USE_CASE_DEV_MIC "Mic" /**< Microphone Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */
|
|
|
b64678 |
#define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From ca67e823833213e140a09ce43b6399b7676616df Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Fri, 6 Dec 2019 11:11:54 +0100
|
|
|
b64678 |
Subject: [PATCH 15/16] ucm: docs - add note about the sequences and device
|
|
|
b64678 |
split
|
|
|
02270a |
|
|
|
02270a |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
include/use-case.h | 5 +++++
|
|
|
b64678 |
1 file changed, 5 insertions(+)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/include/use-case.h b/include/use-case.h
|
|
|
b64678 |
index b04f7b9d..2efcb4d8 100644
|
|
|
b64678 |
--- a/include/use-case.h
|
|
|
b64678 |
+++ b/include/use-case.h
|
|
|
b64678 |
@@ -119,6 +119,11 @@ extern "C" {
|
|
|
b64678 |
* be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are
|
|
|
b64678 |
* allowed. The names with numbers must be continuous.
|
|
|
b64678 |
*
|
|
|
b64678 |
+ * If EnableSequence/DisableSequence controls independent paths in the hardware
|
|
|
b64678 |
+ * it is also recommended to split playback and capture UCM devices and use
|
|
|
b64678 |
+ * the number suffixes. Example use case: Use the integrated microphone
|
|
|
b64678 |
+ * in the laptop instead the microphone in headphones.
|
|
|
b64678 |
+ *
|
|
|
b64678 |
* The preference of the devices is determined by the priority value.
|
|
|
b64678 |
*/
|
|
|
b64678 |
#define SND_USE_CASE_DEV_NONE "None" /**< None Device */
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|
|
|
02270a |
|
|
|
b64678 |
From f828dfe549fbab0a920768c63ebd3478272954eb Mon Sep 17 00:00:00 2001
|
|
|
02270a |
From: Jaroslav Kysela <perex@perex.cz>
|
|
|
b64678 |
Date: Tue, 10 Dec 2019 11:48:06 +0100
|
|
|
b64678 |
Subject: [PATCH 16/16] ucm: docs - remove MixerCopy values, add Priority for
|
|
|
b64678 |
verb, improve priority docs
|
|
|
02270a |
|
|
|
b64678 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
|
02270a |
---
|
|
|
b64678 |
include/use-case.h | 18 ++++++------------
|
|
|
b64678 |
1 file changed, 6 insertions(+), 12 deletions(-)
|
|
|
b64678 |
|
|
|
b64678 |
diff --git a/include/use-case.h b/include/use-case.h
|
|
|
b64678 |
index 2efcb4d8..134303af 100644
|
|
|
b64678 |
--- a/include/use-case.h
|
|
|
b64678 |
+++ b/include/use-case.h
|
|
|
b64678 |
@@ -274,6 +274,10 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
* Recommended names for values:
|
|
|
b64678 |
* - TQ
|
|
|
b64678 |
* - Tone Quality
|
|
|
b64678 |
+ * - Priority
|
|
|
b64678 |
+ * - priority value (1-10000), higher value means higher priority
|
|
|
b64678 |
+ * - valid only for verbs
|
|
|
b64678 |
+ * - for devices - PlaybackPriority and CapturePriority
|
|
|
b64678 |
* - PlaybackPCM
|
|
|
b64678 |
* - full PCM playback device name
|
|
|
b64678 |
* - PlaybackPCMIsDummy
|
|
|
b64678 |
@@ -301,7 +305,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
* - playback control switch identifier string
|
|
|
b64678 |
* - can be parsed using snd_use_case_parse_ctl_elem_id()
|
|
|
b64678 |
* - PlaybackPriority
|
|
|
b64678 |
- * - priority value (1-10000), default value is 100, higher value means lower priority
|
|
|
b64678 |
+ * - priority value (1-10000), higher value means higher priority
|
|
|
b64678 |
* - CaptureRate
|
|
|
b64678 |
* - capture device sample rate
|
|
|
b64678 |
* - CaptureChannels
|
|
|
b64678 |
@@ -315,17 +319,12 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
* - capture control switch identifier string
|
|
|
b64678 |
* - can be parsed using snd_use_case_parse_ctl_elem_id()
|
|
|
b64678 |
* - CapturePriority
|
|
|
b64678 |
- * - priority value (1-10000), default value is 100, higher value means lower priority
|
|
|
b64678 |
+ * - priority value (1-10000), higher value means higher priority
|
|
|
b64678 |
* - PlaybackMixer
|
|
|
b64678 |
* - name of playback mixer
|
|
|
b64678 |
* - PlaybackMixerElem
|
|
|
b64678 |
* - mixer element playback identifier
|
|
|
b64678 |
* - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
- * - PlaybackMixerCopy
|
|
|
b64678 |
- * - additional mixer element playback identifier
|
|
|
b64678 |
- * - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
- * - those elements should copy the volume and switch settings
|
|
|
b64678 |
- * - element identifiers are separated using the | character
|
|
|
b64678 |
* - PlaybackMasterElem
|
|
|
b64678 |
* - mixer element playback identifier for the master control
|
|
|
b64678 |
* - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
@@ -337,11 +336,6 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|
|
b64678 |
* - CaptureMixerElem
|
|
|
b64678 |
* - mixer element capture identifier
|
|
|
b64678 |
* - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
- * - CaptureMixerCopy
|
|
|
b64678 |
- * - additional mixer element capture identifier
|
|
|
b64678 |
- * - can be parsed using snd_use_case_parse_selem_id()
|
|
|
b64678 |
- * - those elements should copy the volume and switch settings
|
|
|
b64678 |
- * - element identifiers are separated using the | character
|
|
|
b64678 |
* - CaptureMasterElem
|
|
|
b64678 |
* - mixer element playback identifier for the master control
|
|
|
b64678 |
* - can be parsed using snd_use_case_parse_selem_id()
|
|
|
02270a |
--
|
|
|
02270a |
2.20.1
|
|
|
02270a |
|