]> git.alsa-project.org Git - alsa-utils.git/commitdiff
- search cardX entry if no card is found and -F option is given (i.e.
authorTakashi Iwai <tiwai@suse.de>
Fri, 20 Jun 2003 18:09:49 +0000 (18:09 +0000)
committerTakashi Iwai <tiwai@suse.de>
Fri, 20 Jun 2003 18:09:49 +0000 (18:09 +0000)
  force to read the old-style entry).

alsactl/alsactl.c

index 9ec3f1812ee2c9eb4760b462b5f62bdbf85c9b0e..f8b91239f2e756d361cc5a40bd7b5cf63fa17dad 100644 (file)
@@ -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);