Skip to content

Commit 4a0372c

Browse files
committed
amixer: info: Add handling of a new components string
Changes added to kernel [1] and alsa-lib [2] allow usage of an extended components string, amend amixer to allow display of the new string. [1] https://lore.kernel.org/all/20260122111249.67319-1-mstrozek@opensource.cirrus.com/ [2] alsa-project/alsa-lib#494 Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
1 parent 64f84ec commit 4a0372c

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

alsactl/info.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,12 @@ static int hwdep_device_list(snd_ctl_t *ctl)
193193
static int card_info(snd_ctl_t *ctl)
194194
{
195195
snd_ctl_card_info_t *info;
196+
snd_ctl_card_components_t *components;
196197
snd_ctl_elem_list_t *clist;
197198
int err;
198199

199200
snd_ctl_card_info_alloca(&info);
201+
snd_ctl_card_components_alloca(&components);
200202
snd_ctl_elem_list_alloca(&clist);
201203

202204
if ((err = snd_ctl_card_info(ctl, info)) < 0) {
@@ -211,7 +213,10 @@ static int card_info(snd_ctl_t *ctl)
211213
snd_ctl_card_info_get_longname(info));
212214
printf(" driver_name: %s\n", snd_ctl_card_info_get_driver(info));
213215
printf(" mixer_name: %s\n", snd_ctl_card_info_get_mixername(info));
214-
printf(" components: %s\n", snd_ctl_card_info_get_components(info));
216+
if (snd_ctl_card_components(ctl, components) >= 0)
217+
printf(" components: %s\n", snd_ctl_card_components_get_string(components));
218+
else
219+
printf(" components: %s\n", snd_ctl_card_info_get_components(info));
215220
if ((err = snd_ctl_elem_list(ctl, clist)) < 0) {
216221
error("snd_ctl_elem_list failure: %s", snd_strerror(err));
217222
} else {

amixer/amixer.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ static int info(void)
9494
snd_ctl_t *handle;
9595
snd_mixer_t *mhandle;
9696
snd_ctl_card_info_t *info;
97+
snd_ctl_card_components_t *components;
9798
snd_ctl_elem_list_t *clist;
9899
snd_ctl_card_info_alloca(&info);
100+
snd_ctl_card_components_alloca(&components);
99101
snd_ctl_elem_list_alloca(&clist);
100102

101103
if ((err = snd_ctl_open(&handle, card, 0)) < 0) {
@@ -110,7 +112,10 @@ static int info(void)
110112
printf("Card %s '%s'/'%s'\n", card, snd_ctl_card_info_get_id(info),
111113
snd_ctl_card_info_get_longname(info));
112114
printf(" Mixer name : '%s'\n", snd_ctl_card_info_get_mixername(info));
113-
printf(" Components : '%s'\n", snd_ctl_card_info_get_components(info));
115+
if (snd_ctl_card_components(handle, components) >= 0)
116+
printf(" Components : '%s'\n", snd_ctl_card_components_get_string(components));
117+
else
118+
printf(" Components : '%s'\n", snd_ctl_card_info_get_components(info));
114119
if ((err = snd_ctl_elem_list(handle, clist)) < 0) {
115120
error("snd_ctl_elem_list failure: %s", snd_strerror(err));
116121
} else {

0 commit comments

Comments
 (0)