]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: fix the nested iteration
authorJaroslav Kysela <perex@perex.cz>
Tue, 1 Jun 2021 15:47:42 +0000 (17:47 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 1 Jun 2021 15:49:27 +0000 (17:49 +0200)
There may be nested iterations for hw: card names.
Handle this card name in snd_card_iterator_sinit().

BugLink: https://github.com/alsa-project/alsa-lib/issues/142
Fixes: eefc2c6 ("alsactl: use card iterator functions for all card loops")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsactl/utils.c

index c79fd951b8e00534e869538036562cf260edc64e..881b505396ae6e0887d4485e4673715dbafe35de 100644 (file)
@@ -247,6 +247,8 @@ int snd_card_iterator_sinit(struct snd_card_iterator *iter, const char *cardname
        int cardno = -1;
 
        if (cardname) {
+               if (strncmp(cardname, "hw:", 3) == 0)
+                       cardname += 3;
                cardno = snd_card_get_index(cardname);
                if (cardno < 0) {
                        error("Cannot find soundcard '%s'...", cardname);