These are patches we have been carrying downstream for quite some time now at Endless (some of them which are a refactor of an earlier work by Mario Sanchez Prada from ~3.5 years ago), plus a fix for problem I have worked at recently (patches 3 and 4). Essentially we want to have active streams (and default sink/source configuration) moved to new devices on hotplug, but respecting a priority list. My understanding is that this also what module-device-manager provides, but it relies on something (a client?) registering the priority lists, which on Colin's main target scenario was kmix/phonon (although I must confess I have not looked too deeply into m-d-m, so some of this may not be super accurate). We don't have such piece to register priority lists at Endless, which uses the default GNOME audio UI, and for this simpler, static case, a few changes on module-switch-on-port-available (patches 1 and 2 of this series) have been enough. The priorities come from the ALSA paths configuration files, which we also tweaked a bit to fit our needs (not part of this series). In addition to what I mentioned on the previous paragraph, we also want to have the same functionality working across different cards, specifically for some laptops with AMD graphics, where all analog ports are on one ALSA card but the HDMI port is on a separate ALSA card which only has that port. With the recent default sink / source logic improvements (thanks Tanu!) we can now have it working through module-switch-on-connect, as long as we change it to not ignore HDMI sinks (patch 4). But when testing this case I stumbled upon a problem where a card can get stuck on an unavailable profile when there is no other port to switch to, with a non-working sink available, which I'm addressing with patch 3. I believe all of these would be beneficial upstream and none of them are too controversial, thus this series, but I'm open for any suggestions on other possible approaches to address these problems and to do some rework to have them suit upstream better. Thanks in advance for any support. João Paulo Rechi Vita (4): card: New API pa_card_profile_has_available_ports switch-on-port-available: Change criteria for keeping the active profile alsa-card: Switch profile when the active one becomes unavailable switch-on-connect: Do not ignore HDMI sinks src/modules/alsa/module-alsa-card.c | 54 +++++++++++++++++++ src/modules/module-switch-on-connect.c | 13 +++-- src/modules/module-switch-on-port-available.c | 32 +++++------ src/pulsecore/card.c | 18 +++++++ src/pulsecore/card.h | 3 ++ 5 files changed, 95 insertions(+), 25 deletions(-) -- 2.18.0