summaryrefslogtreecommitdiff
path: root/alsamixer
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2021-04-06 18:38:18 +0200
committerJaroslav Kysela <perex@perex.cz>2021-04-06 20:25:58 +0200
commit0a6b63a2c423821d8537b4e5d13f0ea163decb01 (patch)
tree38ccb57d3576a3a3820d3c16dbc84075f494a178 /alsamixer
parent7a7e064f83f128e4e115c24ef15ba6788b1709a6 (diff)
downloadalsa-utils-0a6b63a2c423821d8537b4e5d13f0ea163decb01.tar.gz
amixer/alsamixer: use sysdefault:<CARD> devices instead hw:<CARD>
The alsa-lib 1.2.5 introduced a new scheme for the default control devices. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'alsamixer')
-rw-r--r--alsamixer/card_select.c4
-rw-r--r--alsamixer/cli.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/alsamixer/card_select.c b/alsamixer/card_select.c
index a58c037..f2ec01f 100644
--- a/alsamixer/card_select.c
+++ b/alsamixer/card_select.c
@@ -125,7 +125,11 @@ static int get_cards(void)
fatal_alsa_error(_("cannot enumerate sound cards"), err);
if (number < 0)
break;
+#if defined(SND_LIB_VER) && SND_LIB_VER(1, 2, 5) <= SND_LIB_VERSION
+ sprintf(buf, "sysdefault:%d", number);
+#else
sprintf(buf, "hw:%d", number);
+#endif
err = snd_ctl_open(&ctl, buf, 0);
if (err < 0)
continue;
diff --git a/alsamixer/cli.c b/alsamixer/cli.c
index 23d34ad..f153f28 100644
--- a/alsamixer/cli.c
+++ b/alsamixer/cli.c
@@ -73,7 +73,7 @@ static void parse_options(int argc, char *argv[])
};
int option;
int card_index;
- static char name_buf[16];
+ static char name_buf[24];
while ((option = getopt_long(argc, argv, short_options,
long_options, NULL)) != -1) {
@@ -88,7 +88,11 @@ static void parse_options(int argc, char *argv[])
fprintf(stderr, _("invalid card index: %s\n"), optarg);
goto fail;
}
+#if defined(SND_LIB_VER) && SND_LIB_VER(1, 2, 5) <= SND_LIB_VERSION
+ sprintf(name_buf, "sysdefault:%d", card_index);
+#else
sprintf(name_buf, "hw:%d", card_index);
+#endif
selem_regopt.device = name_buf;
break;
case 'D':