mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 18:46:32 +01:00
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>
This commit is contained in:
parent
7a7e064f83
commit
0a6b63a2c4
3 changed files with 13 additions and 1 deletions
|
@ -125,7 +125,11 @@ static int get_cards(void)
|
||||||
fatal_alsa_error(_("cannot enumerate sound cards"), err);
|
fatal_alsa_error(_("cannot enumerate sound cards"), err);
|
||||||
if (number < 0)
|
if (number < 0)
|
||||||
break;
|
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);
|
sprintf(buf, "hw:%d", number);
|
||||||
|
#endif
|
||||||
err = snd_ctl_open(&ctl, buf, 0);
|
err = snd_ctl_open(&ctl, buf, 0);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -73,7 +73,7 @@ static void parse_options(int argc, char *argv[])
|
||||||
};
|
};
|
||||||
int option;
|
int option;
|
||||||
int card_index;
|
int card_index;
|
||||||
static char name_buf[16];
|
static char name_buf[24];
|
||||||
|
|
||||||
while ((option = getopt_long(argc, argv, short_options,
|
while ((option = getopt_long(argc, argv, short_options,
|
||||||
long_options, NULL)) != -1) {
|
long_options, NULL)) != -1) {
|
||||||
|
@ -88,7 +88,11 @@ static void parse_options(int argc, char *argv[])
|
||||||
fprintf(stderr, _("invalid card index: %s\n"), optarg);
|
fprintf(stderr, _("invalid card index: %s\n"), optarg);
|
||||||
goto fail;
|
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);
|
sprintf(name_buf, "hw:%d", card_index);
|
||||||
|
#endif
|
||||||
selem_regopt.device = name_buf;
|
selem_regopt.device = name_buf;
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
|
|
|
@ -1806,7 +1806,11 @@ int main(int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
i = snd_card_get_index(optarg);
|
i = snd_card_get_index(optarg);
|
||||||
if (i >= 0 && i < 32)
|
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);
|
sprintf(card, "hw:%i", i);
|
||||||
|
#endif
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Invalid card number.\n");
|
fprintf(stderr, "Invalid card number.\n");
|
||||||
morehelp++;
|
morehelp++;
|
||||||
|
|
Loading…
Reference in a new issue