Accept string type card

Accept string type card entry to be compatible with others.
This commit is contained in:
Takashi Iwai 2005-02-22 20:21:23 +00:00
parent 5741aec950
commit 145f85fff8

View file

@ -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) if (strcmp(id, "comment") == 0)
continue; continue;
if (strcmp(id, "card") == 0) { if (strcmp(id, "card") == 0) {
const char *str;
long v; long v;
if ((err = snd_config_get_integer(n, &v)) < 0) { if ((err = snd_config_get_integer(n, &v)) < 0) {
SNDERR("field %s is not an integer", id); if ((err = snd_config_get_string(n, &str)) < 0) {
goto _err; SNDERR("Invalid field %s", id);
} goto _err;
*cardp = v; }
*cardp = snd_card_get_index(str);
if (*cardp < 0) {
SNDERR("Cannot get index for %s", str);
err = *cardp;
goto _err;
}
} else
*cardp = v;
continue; continue;
} }
if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) { if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) {