On Fri, 2016-06-10 at 20:55 +0300, Tanu Kaskinen wrote: > From the v1 cover letter: > > This patch set fixes a case where an unavailable HDMI profile gets > selected by default, even when an available one exists too. The > underlying problem is that the alsa card doesn't manage profile > availability information at all, so all profiles have unknown > availability. These patches add some simple profile availability > management logic to module-alsa-card. Some refactoring was > required too. > > BugLink: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8448 > > > Changes in v2: > > * Don't add pa_card_profile.ports. It's not needed. > * Don't move the CARD_NEW hook to pa_card_put(). Instead, add a new >  hook for choosing the initial profile: CARD_CHOOSE_INITIAL_PROFILE. >  Card implementations now must always call >  pa_card_choose_initial_profile() between pa_card_new() and >  pa_card_put(). This allows initializing the card jack states after >  pa_card_new() and overriding the profile selection policy before >  pa_card_put(). > * Reorder the code in module-card-restore to adapt to the new hook. > * Replace the pa_card_state_t enum with a boolean that indicates >  whether the card has been linked. > * Log card unlinking and send unlink notifications only if the card >  is linked when freeing it. > > David also suggested that when jack states change, we could update the > state of available profiles before updating the state of unavailable > profiles. The rationale was that we do that with port states to work > around a deficiency in module-switch-on-port-available, so maybe it > would make sense for profiles too. I agreed to do that, but later I > found out that implementing this would be more complicated than > expected, because UCM would need special handling. Since this change > is not necessary, I decided to not implement it. > > > Tanu Kaskinen (6): >  alsa, bluetooth: fail if user-requested profile doesn't exist >  card: don't allow the CARD_NEW hook to fail >  card: move profile selection after pa_card_new() >  card: remove pa_card_new_data.active_profile >  card: simplify setting pa_card.name >  alsa: set availability for (some) unavailable profiles > >  src/modules/alsa/module-alsa-card.c          |  52 +++++++++++- >  src/modules/bluetooth/module-bluez4-device.c |  28 +++++-- >  src/modules/bluetooth/module-bluez5-device.c |   2 + >  src/modules/macosx/module-coreaudio-device.c |   2 + >  src/modules/module-card-restore.c            |  36 +++++--- >  src/pulsecore/card.c                         | 120 +++++++++++++++------------ >  src/pulsecore/card.h                         |  14 ++-- >  src/pulsecore/core.h                         |   1 + >  8 files changed, 173 insertions(+), 82 deletions(-) I pushed these now with a fix for the missing pa_card_new_data_done() call (except the fifth patch, as we agreed that it can just be dropped). Thanks, Alexander, for the reviews! -- Tanu