alsa-mixer: Make speaker get available=no when headphones are plugged in

While developing the new UI we had to ask ourselves the question of whether
"speakers" should be considered available when headphones are plugged in.
In most cases, they are not available and therefore we should list them
as such.

OTOH, we don't want unplugging the headphones to be considered an act of
wanting to use the speakers (the user might prefer HDMI), and there might
be line-outs that keeps the speakers from unmuting anyway. So, at this point,
I think the most reasonable would be to make the speakers have
PA_PORT_AVAILABLE_NO when headphones are plugged in and
PA_PORT_AVAILABLE_UNKNOWN when they are not. But we might want to revisit
this decision once we have the priority lists up and running.

The same reasoning applies for "Internal Mic", which should become unavailable
when any other mic is plugged in.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2012-02-23 07:17:07 +01:00 committed by Arun Raghavan
parent 793f46320e
commit e02cb7fb2e
7 changed files with 73 additions and 3 deletions

View file

@ -120,6 +120,9 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
pa_source *source;
pa_bool_t is_active_profile, is_active_port;
if (port->available == PA_PORT_AVAILABLE_UNKNOWN)
return PA_HOOK_OK;
pa_log_debug("finding port %s", port->name);
PA_IDXSET_FOREACH(card, c->cards, state)