alsactl: init - iterate through all cards for the initial settings

The generic initialization code returns error code 99 (-99). Take
all those codes equal or above (bellow) this value as non-fatal.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-05-14 18:14:31 +02:00
parent f9abf36d34
commit 598488c4af

View file

@ -1745,7 +1745,7 @@ static int parse(struct space *space, const char *filename)
int init(const char *filename, const char *cardname) int init(const char *filename, const char *cardname)
{ {
struct space *space; struct space *space;
int err = 0, card, first; int err = 0, lasterr = 0, card, first;
sysfs_init(); sysfs_init();
if (!cardname) { if (!cardname) {
@ -1767,11 +1767,17 @@ int init(const char *filename, const char *cardname)
space->rootdir = new_root_dir(filename); space->rootdir = new_root_dir(filename);
if (space->rootdir != NULL) if (space->rootdir != NULL)
err = parse(space, filename); err = parse(space, filename);
if (err <= -99) { /* non-fatal errors */
if (lasterr == 0)
lasterr = err;
err = 0;
}
free_space(space); free_space(space);
} }
if (err < 0) if (err < 0)
break; break;
} }
err = lasterr;
} else { } else {
card = snd_card_get_index(cardname); card = snd_card_get_index(cardname);
if (card < 0) { if (card < 0) {