Commit 484b6986 authored by Hui Wang's avatar Hui Wang
Browse files

card-restore: setting preferred ports in entry_from_card



If the preferred ports are not set in this function, the
entrys_equal() always returns false in the card_put_hook_callback().
This will make the entry be written into the metadata and the
preferred ports will be cleaned by a mistake.

And we met a hdmi audio bug which has sth to do with this issue, on
the machines with the legacy HDA audio driver, the hdmi port has lower
priority than speaker, users need to manually select the hdmi to be
active output port, then the preferred output port is hdmi for this
sound card, after reboot, the card_put_hook_callback() in the
module-card-restore.c will be called and the preferred ports are
cleaned by a mistake, then the hdmi output port or hdmi sink couldn't
switch to be active after reboot or resume automatically. That is
because the preferred ports are cleaned and hdmi port has lower
priority than speaker, the profile_good_for_output() in the
module-switch-on-port-available.c always returns false.
Signed-off-by: Hui Wang's avatarHui Wang <hui.wang@canonical.com>
parent 197fda6b
Pipeline #449068 passed with stages
in 5 minutes and 35 seconds
...@@ -158,6 +158,11 @@ static struct entry *entry_from_card(pa_card *card) { ...@@ -158,6 +158,11 @@ static struct entry *entry_from_card(pa_card *card) {
if (card->save_profile || entry->profile_is_sticky) if (card->save_profile || entry->profile_is_sticky)
entry->profile = pa_xstrdup(card->active_profile->name); entry->profile = pa_xstrdup(card->active_profile->name);
if (card->preferred_input_port)
entry->preferred_input_port = pa_xstrdup(card->preferred_input_port->name);
if (card->preferred_output_port)
entry->preferred_output_port = pa_xstrdup(card->preferred_output_port->name);
PA_HASHMAP_FOREACH(port, card->ports, state) { PA_HASHMAP_FOREACH(port, card->ports, state) {
p_info = port_info_new(port); p_info = port_info_new(port);
pa_assert_se(pa_hashmap_put(entry->ports, p_info->name, p_info) >= 0); pa_assert_se(pa_hashmap_put(entry->ports, p_info->name, p_info) >= 0);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment