alsaucm: use the first sound card (use case name 'hw:CARDNO') as default

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-11-25 17:58:51 +01:00
parent 3c740d9049
commit 745c5df260
2 changed files with 11 additions and 11 deletions

View file

@ -1,7 +1,10 @@
#!/bin/bash
#GDB="gdb --args"
#GDB="strace"
#GDB="valgrind --leak-check=yes --show-reachable=yes"
ALSA_CONFIG_UCM="$HOME/alsa/alsa-lib/test/ucm" \
#ALSA_CONFIG_UCM="$HOME/alsa/alsa-ucm-conf/ucm" \
ALSA_CONFIG_UCM2="$HOME/alsa/alsa-ucm-conf/ucm2" \
LD_PRELOAD="$HOME/alsa/alsa-lib/src/.libs/libasound.so" \
$GDB ./alsaucm "$@"

View file

@ -188,22 +188,19 @@ static void my_exit(struct context *context, int exitcode)
static void do_initial_open(struct context *context)
{
const char **list;
int err;
int card, err;
char name[16];
if (!context->no_open && context->card == NULL) {
err = snd_use_case_card_list(&list);
card = -1;
err = snd_card_next(&card);
if (err < 0) {
fprintf(stderr, "%s: unable to obtain card list: %s\n",
fprintf(stderr, "%s: no sound card found: %s\n",
context->command, snd_strerror(err));
my_exit(context, EXIT_FAILURE);
}
if (err == 0) {
printf("No card found\n");
my_exit(context, EXIT_SUCCESS);
}
context->card = strdup(list[0]);
snd_use_case_free_list(list, err);
snprintf(name, sizeof(name), "hw:%d", card);
context->card = strdup(name);
}
/* open library */