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