diff --git a/alsaucm/go.sh b/alsaucm/go.sh index 2aadd1c..2e7d204 100755 --- a/alsaucm/go.sh +++ b/alsaucm/go.sh @@ -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 "$@" diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c index 7677422..8b1c8c7 100644 --- a/alsaucm/usecase.c +++ b/alsaucm/usecase.c @@ -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 */