From: Takashi Iwai Date: Tue, 22 Feb 2005 20:21:23 +0000 (+0000) Subject: Accept string type card X-Git-Tag: v1.0.9rc1~15 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=145f85fff8797f05ecf5122a634a3a512a8093d3;p=alsa-lib.git Accept string type card Accept string type card entry to be compatible with others. --- diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c index 9a1b6be7..15570a57 100644 --- a/src/pcm/pcm_softvol.c +++ b/src/pcm/pcm_softvol.c @@ -686,12 +686,21 @@ static int parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int * if (strcmp(id, "comment") == 0) continue; if (strcmp(id, "card") == 0) { + const char *str; long v; if ((err = snd_config_get_integer(n, &v)) < 0) { - SNDERR("field %s is not an integer", id); - goto _err; - } - *cardp = v; + if ((err = snd_config_get_string(n, &str)) < 0) { + SNDERR("Invalid field %s", id); + goto _err; + } + *cardp = snd_card_get_index(str); + if (*cardp < 0) { + SNDERR("Cannot get index for %s", str); + err = *cardp; + goto _err; + } + } else + *cardp = v; continue; } if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) {