tmix: do not hardcode controls IDs in TinyALSA interface - spoon - dwm status utility (2f30 fork)
 (HTM) git clone git://src.adamsgaard.dk/spoon
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 45e33c28830e3caf4850d7629db438adc1f28f7a
 (DIR) parent ad1bff15ed67e2462bf4d29cd8ab9a60d3e0dfc1
 (HTM) Author: Svyatoslav Mishyn <juef@openmailbox.org>
       Date:   Tue, 24 Oct 2017 16:10:06 +0300
       
       mix: do not hardcode controls IDs in TinyALSA interface
       
       Diffstat:
         M mix.c                               |       8 ++++----
       
       1 file changed, 4 insertions(+), 4 deletions(-)
       ---
 (DIR) diff --git a/mix.c b/mix.c
       t@@ -183,8 +183,8 @@ mixread(void *arg, char *buf, size_t len)
                        return -1;
                }
        
       -        /* Master Playback Switch, see `tinymix contents` */
       -        if ((ctl = mixer_get_ctl(mixer, 10)) == NULL) {
       +        if ((ctl = mixer_get_ctl_by_name(mixer, "Master Playback Switch"))
       +            == NULL) {
                        fprintf(stderr, "mixer_get_ctl_by_name() failed\n");
                        rc = -1;
                        goto exit;
       t@@ -194,8 +194,8 @@ mixread(void *arg, char *buf, size_t len)
                        goto exit;
                }
        
       -        /* Master Playback Volume, see `tinymix contents` */
       -        if ((ctl = mixer_get_ctl(mixer, 9)) == NULL) {
       +        if ((ctl = mixer_get_ctl_by_name(mixer, "Master Playback Volume"))
       +            == NULL) {
                        fprintf(stderr, "mixer_get_ctl_by_name() failed\n");
                        rc = -1;
                        goto exit;