forked from pool/alsa-utils
89 lines
2.7 KiB
Diff
89 lines
2.7 KiB
Diff
|
From bd15b1e5ea23d25fcb2ccccd1cf25350c60fe527 Mon Sep 17 00:00:00 2001
|
||
|
From: Clemens Ladisch <clemens@ladisch.de>
|
||
|
Date: Wed, 26 May 2010 10:28:11 +0200
|
||
|
Subject: [PATCH 05/13] alsactl: change format of comment node in state file
|
||
|
|
||
|
Make the comment node a separate node in the state file (join=0), and
|
||
|
move it after the other fields of the respective control.
|
||
|
|
||
|
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
|
||
|
---
|
||
|
alsactl/state.c | 20 +++++++++++++-------
|
||
|
1 files changed, 13 insertions(+), 7 deletions(-)
|
||
|
|
||
|
diff --git a/alsactl/state.c b/alsactl/state.c
|
||
|
index 538fa82..01b1cd6 100644
|
||
|
--- a/alsactl/state.c
|
||
|
+++ b/alsactl/state.c
|
||
|
@@ -266,9 +266,9 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
|
||
|
error("snd_config_compound_add: %s", snd_strerror(err));
|
||
|
return err;
|
||
|
}
|
||
|
- err = snd_config_compound_add(control, "comment", 1, &comment);
|
||
|
+ err = snd_config_make_compound(&comment, "comment", 0);
|
||
|
if (err < 0) {
|
||
|
- error("snd_config_compound_add: %s", snd_strerror(err));
|
||
|
+ error("snd_config_make_compound: %s", snd_strerror(err));
|
||
|
return err;
|
||
|
}
|
||
|
|
||
|
@@ -432,7 +432,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
|
||
|
error("snd_config_string_add: %s", snd_strerror(err));
|
||
|
return err;
|
||
|
}
|
||
|
- return 0;
|
||
|
+ goto finish;
|
||
|
}
|
||
|
default:
|
||
|
break;
|
||
|
@@ -446,21 +446,21 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
|
||
|
error("snd_config_string_add: %s", snd_strerror(err));
|
||
|
return err;
|
||
|
}
|
||
|
- return 0;
|
||
|
+ goto finish;
|
||
|
case SND_CTL_ELEM_TYPE_INTEGER:
|
||
|
err = snd_config_integer_add(control, "value", snd_ctl_elem_value_get_integer(ctl, 0));
|
||
|
if (err < 0) {
|
||
|
error("snd_config_integer_add: %s", snd_strerror(err));
|
||
|
return err;
|
||
|
}
|
||
|
- return 0;
|
||
|
+ goto finish;
|
||
|
case SND_CTL_ELEM_TYPE_INTEGER64:
|
||
|
err = snd_config_integer64_add(control, "value", snd_ctl_elem_value_get_integer64(ctl, 0));
|
||
|
if (err < 0) {
|
||
|
error("snd_config_integer64_add: %s", snd_strerror(err));
|
||
|
return err;
|
||
|
}
|
||
|
- return 0;
|
||
|
+ goto finish;
|
||
|
case SND_CTL_ELEM_TYPE_ENUMERATED:
|
||
|
{
|
||
|
unsigned int v = snd_ctl_elem_value_get_enumerated(ctl, 0);
|
||
|
@@ -475,7 +475,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
|
||
|
}
|
||
|
if (err < 0)
|
||
|
error("snd_config add: %s", snd_strerror(err));
|
||
|
- return 0;
|
||
|
+ goto finish;
|
||
|
}
|
||
|
default:
|
||
|
error("Unknown control type: %d\n", type);
|
||
|
@@ -540,6 +540,12 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
|
||
|
return -EINVAL;
|
||
|
}
|
||
|
|
||
|
+finish:
|
||
|
+ err = snd_config_add(control, comment);
|
||
|
+ if (err < 0) {
|
||
|
+ error("snd_config_add: %s", snd_strerror(err));
|
||
|
+ return err;
|
||
|
+ }
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
--
|
||
|
1.7.2.1
|
||
|
|