device-port, switch-on-port-available: fix automatic profile changing when current...
authorTanu Kaskinen <tanuk@iki.fi>
Mon, 31 Jul 2017 06:42:31 +0000 (09:42 +0300)
committerTanu Kaskinen <tanuk@iki.fi>
Tue, 5 Sep 2017 10:46:26 +0000 (13:46 +0300)
commit5f27c2ec2fb0477f213e6794113182eaee1c43ba
treef01d3d20513cd84ed4a60c94abd08856e5134abb
parent4e6d9e321400cbb660b4373db6b50bea71707641
device-port, switch-on-port-available: fix automatic profile changing when current profile is off

module-switch-on-port-available didn't do anything when a port changes
its status if the card didn't have any sinks or sources. This was to
avoid bad things during card initialization, but the if condition also
prevented any profile switches away from the "off" profile, because the
card has no sinks or sources when the "off" profile is active.

pa_card nowadays has the "linked" flag that
module-switch-on-port-available could have checked instead, but since it
doesn't make sense to emit port status change events before the card has
been initialized, I added the check in pa_device_port_set_available()
instead.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=101794
src/modules/module-switch-on-port-available.c
src/pulsecore/device-port.c