From 43a2330ab0b866387ad3b5450c60d737590207ec Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 20 Jun 2003 18:09:49 +0000 Subject: [PATCH] - search cardX entry if no card is found and -F option is given (i.e. force to read the old-style entry). --- alsactl/alsactl.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c index 9ec3f18..f8b9123 100644 --- a/alsactl/alsactl.c +++ b/alsactl/alsactl.c @@ -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); -- 2.47.1