ucm: add cdev

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2010-11-23 15:58:14 +01:00
parent cdc9dd50bf
commit aaf55f1641
3 changed files with 19 additions and 3 deletions

View file

@ -133,6 +133,9 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,
list_for_each(pos, seq) {
s = list_entry(pos, struct sequence_element, list);
switch (s->type) {
case SEQUENCE_ELEMENT_TYPE_CDEV:
uc_error("cdev not yet implemented: '%s'", s->data.cdev);
break;
case SEQUENCE_ELEMENT_TYPE_CSET:
uc_error("cset not yet implemented: '%s'", s->data.cset);
break;

View file

@ -188,6 +188,7 @@ static int parse_supported_device(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,
*
* Sequence controls elements are in the following form:-
*
* cdev "hw:0,0"
* cset "element_id_syntax value_syntax"
* usleep time
* exec "any unix command with arguments"
@ -233,6 +234,16 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,
return -ENOMEM;
list_add_tail(&curr->list, base);
if (strcmp(cmd, "cdev") == 0) {
curr->type = SEQUENCE_ELEMENT_TYPE_CDEV;
err = parse_string(n, &curr->data.cdev);
if (err < 0) {
uc_error("error: cdev requires a string!");
return err;
}
continue;
}
if (strcmp(cmd, "cset") == 0) {
curr->type = SEQUENCE_ELEMENT_TYPE_CSET;
err = parse_string(n, &curr->data.cset);

View file

@ -42,9 +42,10 @@
#define MAX_FILE 256
#define ALSA_USE_CASE_DIR ALSA_CONFIG_DIR "/ucm"
#define SEQUENCE_ELEMENT_TYPE_CSET 1
#define SEQUENCE_ELEMENT_TYPE_SLEEP 2
#define SEQUENCE_ELEMENT_TYPE_EXEC 3
#define SEQUENCE_ELEMENT_TYPE_CDEV 1
#define SEQUENCE_ELEMENT_TYPE_CSET 2
#define SEQUENCE_ELEMENT_TYPE_SLEEP 3
#define SEQUENCE_ELEMENT_TYPE_EXEC 4
struct ucm_value {
struct list_head list;
@ -57,6 +58,7 @@ struct sequence_element {
unsigned int type;
union {
long sleep; /* Sleep time in msecs if sleep element, else 0 */
char *cdev;
char *cset;
char *exec;
} data;