Hi, On my system the "Master" mixer is just an odd switch, while "PCM" is the real one. (discussion in #fedora-desktop) PA tries to use "Master" because it does not check if it is useable, which causes weird volume control bugs. The attached patch fixes this by checking this in pa_alsa_find_elem(). ----------------------------- Check if a mixer offers volume control before attempting to use it. Signed-off-by: Adel Gadllah <adel.gadllah at gmail.com> diff --git a/src/modules/alsa-util.c b/src/modules/alsa-util.c index 20dc400..7eacf72 100644 --- a/src/modules/alsa-util.c +++ b/src/modules/alsa-util.c @@ -740,6 +740,16 @@ int pa_alsa_prepare_mixer(snd_mixer_t *mixer, const char *dev) { return 0; } +static int pa_alsa_elem_has_volume(snd_mixer_elem_t *elem) { + pa_assert(elem); + + if (snd_mixer_selem_has_playback_volume(elem)) + return 1; + if (snd_mixer_selem_has_capture_volume(elem)) + return 1; + return 0; +} + snd_mixer_elem_t *pa_alsa_find_elem(snd_mixer_t *mixer, const char *name, const char *fallback) { snd_mixer_elem_t *elem; snd_mixer_selem_id_t *sid = NULL; @@ -751,13 +761,13 @@ snd_mixer_elem_t *pa_alsa_find_elem(snd_mixer_t *mixer, const char *name, const snd_mixer_selem_id_set_name(sid, name); - if (!(elem = snd_mixer_find_selem(mixer, sid))) { + if (!(elem = snd_mixer_find_selem(mixer, sid)) || !pa_alsa_elem_has_volume(elem)) { pa_log_info("Cannot find mixer control \"%s\".", snd_mixer_selem_id_get_name(sid)); if (fallback) { snd_mixer_selem_id_set_name(sid, fallback); - if (!(elem = snd_mixer_find_selem(mixer, sid))) + if (!(elem = snd_mixer_find_selem(mixer, sid)) || !pa_alsa_elem_has_volume(elem)) pa_log_warn("Cannot find fallback mixer control \"%s\".", snd_mixer_selem_id_get_name(sid)); } }