mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 17:25:42 +01:00
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>
This commit is contained in:
parent
4f29877d54
commit
bd15b1e5ea
1 changed files with 13 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue