alsa-mixer: Fix mapping_group_available() logic
authorTanu Kaskinen <tanuk@iki.fi>
Tue, 21 Jul 2020 07:26:43 +0000 (10:26 +0300)
committerTanu Kaskinen <tanuk@iki.fi>
Mon, 10 Aug 2020 17:54:21 +0000 (20:54 +0300)
commit1b44b44c75dab41a58a8c4803e65e7ffcb58077a
tree2c962b4df32a46a06014327f2345aeb836caf6b1
parent0ce3008605e5f644fac4bb5edbb1443110201ec1
alsa-mixer: Fix mapping_group_available() logic

There were three bugs:

1) j->state_plugged was set to PA_AVAILABLE_UNKNOWN too early. It must
be set only after we have found that the jack is shared by two ports.
The result of setting it too early was that no jack ever could have
the PA_AVAILABLE_YES status.

2) The inner jack loop iterated through p->jacks instead of p2->jacks,
so the code didn't compare jacks between two ports at all. As a result
all ports were put in the same availability group.

3) The inner jack loop checked j->state_plugged instead of
j2->state_plugged. The result was that the speaker port, which uses the
Headphone jack to toggle between unknown and unavailable, was put in the
same group with the headphone port.
src/modules/alsa/alsa-mixer.c