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': diff --git a/amixer/amixer.c b/amixer/amixer.c index 3f07842..8424e7b 100644 --- a/amixer/amixer.c +++ b/amixer/amixer.c @@ -1806,7 +1806,11 @@ int main(int argc, char *argv[]) int i; i = snd_card_get_index(optarg); if (i >= 0 && i < 32) +#if defined(SND_LIB_VER) && SND_LIB_VER(1, 2, 5) <= SND_LIB_VERSION + sprintf(card, "sysdefault:%i", i); +#else sprintf(card, "hw:%i", i); +#endif else { fprintf(stderr, "Invalid card number.\n"); morehelp++;