summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-02-04 23:00:23 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-02-04 23:00:23 +0100
commit95b4f4b180e7dae4b7e27dd5cd67d45761095909 (patch)
tree559f56c6bc604f353ccf9e107a9a9e96bae25649
parent55a7d4feed1b94469e7fcbb94405f7451eb4185f (diff)
alsa: try to figure out if a device can handle volume by asking for itsdevs/bu5hm4n/mixer_fix_range
range there are some buggy devices that are just return false for the has function but actually have a min and max on those devices,so we use that to check if its sink/source capable.
-rw-r--r--src/modules/mixer/lib/backends/alsa/alsa.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/modules/mixer/lib/backends/alsa/alsa.c b/src/modules/mixer/lib/backends/alsa/alsa.c
index 063cb23c5..89e6842b5 100644
--- a/src/modules/mixer/lib/backends/alsa/alsa.c
+++ b/src/modules/mixer/lib/backends/alsa/alsa.c
@@ -304,15 +304,28 @@ _alsa_cards_refresh(void)
304 elem = snd_mixer_first_elem(mixer); 304 elem = snd_mixer_first_elem(mixer);
305 for (; elem; elem = snd_mixer_elem_next(elem)) 305 for (; elem; elem = snd_mixer_elem_next(elem))
306 { 306 {
307 long min = 0, max = 0;
307 if (strncmp(snd_mixer_selem_get_name(elem), 308 if (strncmp(snd_mixer_selem_get_name(elem),
308 "Master", sizeof("Master") - 1)) 309 "Master", sizeof("Master") - 1))
309 continue; 310 continue;
310 311
311 //check if its a source or a sink 312 //check if its a source or a sink
312 if (snd_mixer_selem_has_capture_volume(elem)) 313 snd_mixer_selem_get_capture_volume_range(elem, &min, &max);
313 tmp_source = eina_list_append(tmp_source, elem); 314 DBG("Mixer element %p of dev %d has range %ld %ld", elem, card_num, min, max);
314 else if (snd_mixer_selem_has_playback_volume(elem)) 315 if (min < max)
315 tmp_sink = eina_list_append(tmp_sink, elem); 316 {
317 tmp_source = eina_list_append(tmp_source, elem);
318 continue;
319 }
320
321 min = max = 0;
322 snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
323 DBG("Mixer element %p of dev %d has range %ld %ld", elem, card_num, min, max);
324 if (min < max)
325 {
326 tmp_sink = eina_list_append(tmp_sink, elem);
327 continue;
328 }
316 } 329 }
317 330
318 device_name = _alsa_cards_name_get(buf); 331 device_name = _alsa_cards_name_get(buf);