mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
alsa: Jack detection kcontrol implementation
Support the new jack detection interface implemented in Linux 3.3 (and Ubuntu's 3.2 kernel). Jacks are probed and detected using the snd_hctl_* commands, which means we need to listen to them using fdlists. As this detection needs to be active even if there is currently no sink for the jack, so this polling is done on the card level. Also add configuration support in paths, like this: [Jack Headphone] required-any = any ...where 'Jack Headphone' should match 'Headphone Jack' as given by ALSA (as seen in e g 'amixer controls'). "Required", "required-any" and "required-absent" is supported. Using required-any, one can have several ports even though there is no other indication in the mixer that this path exists. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
74e01ad616
commit
dedf1340c6
14 changed files with 464 additions and 105 deletions
|
|
@ -1579,11 +1579,12 @@ static void set_source_name(pa_source_new_data *data, pa_modargs *ma, const char
|
|||
}
|
||||
|
||||
static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, pa_bool_t ignore_dB) {
|
||||
snd_hctl_t *hctl;
|
||||
|
||||
if (!mapping && !element)
|
||||
return;
|
||||
|
||||
if (!(u->mixer_handle = pa_alsa_open_mixer_for_pcm(u->pcm_handle, &u->control_device))) {
|
||||
if (!(u->mixer_handle = pa_alsa_open_mixer_for_pcm(u->pcm_handle, &u->control_device, &hctl))) {
|
||||
pa_log_info("Failed to find a working mixer device.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -1593,7 +1594,7 @@ static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char
|
|||
if (!(u->mixer_path = pa_alsa_path_synthesize(element, PA_ALSA_DIRECTION_INPUT)))
|
||||
goto fail;
|
||||
|
||||
if (pa_alsa_path_probe(u->mixer_path, u->mixer_handle, ignore_dB) < 0)
|
||||
if (pa_alsa_path_probe(u->mixer_path, u->mixer_handle, hctl, ignore_dB) < 0)
|
||||
goto fail;
|
||||
|
||||
pa_log_debug("Probed mixer path %s:", u->mixer_path->name);
|
||||
|
|
@ -1683,7 +1684,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
|
|||
u->mixer_fdl = pa_alsa_fdlist_new();
|
||||
mixer_callback = ctl_mixer_callback;
|
||||
|
||||
if (pa_alsa_fdlist_set_mixer(u->mixer_fdl, u->mixer_handle, u->core->mainloop) < 0) {
|
||||
if (pa_alsa_fdlist_set_handle(u->mixer_fdl, u->mixer_handle, NULL, u->core->mainloop) < 0) {
|
||||
pa_log("Failed to initialize file descriptor monitoring");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue