This is essentially the patch set to avoid the case where * Speakers on 2.1 surround * plug in headphones, profile switches to stereo * unplug headphones, profile remains on stereo and now your subwoofer output disappeared (bad user experience), unless you select the profile manually again. All the first sevent patches really lead up to the last one; which makes module-switch-on-port-available a little refactored, a little more straight forward, a little more aggressive in terms of when it allows itself to change port and profile. I hope it does not collide with other pending routing patch sets too much; and as always when modifying the routing algorithm, there is a ton of use cases you have a possibility to regress, and I haven't tested them all. Therefore testing would be much appreciated. David Henningsson (8): card: Use pa_xmalloc0 when creating new cards and profiles card: Add variables for splitting up a profile alsa-mixer: Fill in input and output names device-port: Add preferred_profile field to pa_device_port card-restore: Save and restore "preferred profile" of port module-switch-on-port-available: Use input and output names module-alsa-card: Report available ports before unavailable ones module-switch-on-port-available: Route to preferred profile src/modules/alsa/alsa-mixer.c | 14 +- src/modules/alsa/alsa-mixer.h | 3 + src/modules/alsa/module-alsa-card.c | 38 ++++-- src/modules/module-card-restore.c | 63 ++++++++- src/modules/module-switch-on-port-available.c | 179 ++++++++++++++++---------- src/pulsecore/card.c | 15 +-- src/pulsecore/card.h | 6 + src/pulsecore/device-port.c | 1 + src/pulsecore/device-port.h | 1 + 9 files changed, 228 insertions(+), 92 deletions(-) -- 1.9.1