mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-08 21:55:42 +01:00
- search cardX entry if no card is found and -F option is given (i.e.
force to read the old-style entry).
This commit is contained in:
parent
f586f8bc08
commit
43a2330ab0
1 changed files with 13 additions and 4 deletions
|
@ -972,7 +972,7 @@ static int set_controls(int card, snd_config_t *top)
|
|||
snd_config_t *control;
|
||||
snd_config_iterator_t i, next;
|
||||
int err;
|
||||
char name[32];
|
||||
char name[32], tmpid[16];
|
||||
const char *id;
|
||||
snd_ctl_card_info_alloca(&info);
|
||||
|
||||
|
@ -990,9 +990,18 @@ static int set_controls(int card, snd_config_t *top)
|
|||
id = snd_ctl_card_info_get_id(info);
|
||||
err = snd_config_searchv(top, &control, "state", id, "control", 0);
|
||||
if (err < 0) {
|
||||
err = 0;
|
||||
fprintf(stderr, "No state is present for card %s\n", id);
|
||||
goto _close;
|
||||
if (force_restore) {
|
||||
sprintf(tmpid, "card%d", card);
|
||||
err = snd_config_searchv(top, &control, "state", tmpid, "control", 0);
|
||||
if (! err)
|
||||
id = tmpid;
|
||||
}
|
||||
if (err < 0) {
|
||||
err = 0;
|
||||
fprintf(stderr, "No state is present for card %s\n", id);
|
||||
goto _close;
|
||||
}
|
||||
id = tmpid;
|
||||
}
|
||||
if (snd_config_get_type(control) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
error("state.%s.control is not a compound\n", id);
|
||||
|
|
Loading…
Reference in a new issue