]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: skip inactive controls
authorTakashi Iwai <tiwai@suse.de>
Mon, 17 Dec 2007 10:49:00 +0000 (11:49 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 17 Dec 2007 10:49:00 +0000 (11:49 +0100)
When using alsactl to save or restore the card settings, it currently
skips over controls that don't have the appropriate read/write
permissions. It should also skip over inactive controls, otherwise it
will get an error when it tries to access that control, and will fail to
save the card state (or fully restore it.)

From: Dave Dillow <dave@thedillows.org>

alsactl/state.c

index 1a2a36859f01e3224d0eb4440bc17db6ccc76d0a..70fa4a59f03141a6106f48e7e643d08c5bb4a06f 100644 (file)
@@ -250,7 +250,8 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
                return err;
        }
 
-       if (!snd_ctl_elem_info_is_readable(info))
+       if (snd_ctl_elem_info_is_inactive(info) ||
+                               !snd_ctl_elem_info_is_readable(info))
                return 0;
        snd_ctl_elem_value_set_id(ctl, id);
        err = snd_ctl_elem_read(handle, ctl);
@@ -1306,7 +1307,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control)
                }
        }
 
-       if (!snd_ctl_elem_info_is_writable(info))
+       if (snd_ctl_elem_info_is_inactive(info) ||
+                               !snd_ctl_elem_info_is_writable(info))
                return 0;
        snd_ctl_elem_value_set_numid(ctl, numid1);