[pulseaudio-discuss] Design question: how to store the "preferred ports" of a card

Tanu Kaskinen tanuk at iki.fi
Thu Feb 25 16:18:13 UTC 2016


Some time ago I submitted a patch[1] for fixing the HDMI routing
regression[2]. The patch introduces two new variables for cards:
preferred_input_port and preferred_output_port. The variables are
internal to module-switch-on-port-available. It turned out that the
patch doesn't fix the bug properly, because the variables are not saved
on disk, so the user preferences are forgotten on reboot.

Now my question is what approach is preferred for implementing the
variable persistence. I'd like to keep the logic of setting the
variables in module-switch-on-port-available, but I'd prefer not to
create a new file for storing the variables on disk. So, I propose that
module-card-restore will take care of saving and restoring the

How should module-switch-on-port-available and module-card-restore
communicate with each other? My preference would be to add the
variables to pa_card, and add functions
pa_card_set_preferred_input_port() and
pa_card_set_preferred_output_port(). module-switch-on-port-available
would call those when it wants to change the values, and module-card-
restore would call them when restoring the values from disk. There
would also be new hooks PA_CARD_PREFERRED_INPUT_PORT_CHANGED and the
same for output, which module-card-restore would use to update the on-
disk database.

Another alternative would be to use the card proplist for storing the


[1] https://patchwork.freedesktop.org/patch/74014/
[2] https://bugs.freedesktop.org/show_bug.cgi?id=93946


More information about the pulseaudio-discuss mailing list