Re: [master][RFC PATCH v2 2/3] recipes-multimedia: Add wireplumber audio configuration

Denys Dmytriyenko <[email protected]>
Newsgroups org.yoctoproject.lists.meta-arago
Message-ID <[email protected]>
On Tue, Feb 10, 2026 at 09:22:00PM +0530, Paresh Bhagat wrote:
> - Add set-audio-defaults.sh script for audio setup
> - Add set-audio-defaults.service systemd service
> - Add wireplumber_%.bbappend recipe extension
> 
> Signed-off-by: Paresh Bhagat <[email protected]>
> ---
>  .../wireplumber/set-audio-defaults.service    | 14 +++++++++
>  .../wireplumber/set-audio-defaults.sh         | 30 +++++++++++++++++++
>  .../wireplumber/wireplumber_%.bbappend        | 27 +++++++++++++++++
>  3 files changed, 71 insertions(+)
>  create mode 100644 meta-arago-distro/recipes-multimedia/wireplumber/wireplumber/set-audio-defaults.service
>  create mode 100755 meta-arago-distro/recipes-multimedia/wireplumber/wireplumber/set-audio-defaults.sh
>  create mode 100644 meta-arago-distro/recipes-multimedia/wireplumber/wireplumber_%.bbappend
> 
> diff --git a/meta-arago-distro/recipes-multimedia/wireplumber/wireplumber/set-audio-defaults.service b/meta-arago-distro/recipes-multimedia/wireplumber/wireplumber/set-audio-defaults.service
> new file mode 100644
> index 00000000..b3874542
> --- /dev/null
> +++ b/meta-arago-distro/recipes-multimedia/wireplumber/wireplumber/set-audio-defaults.service
> @@ -0,0 +1,14 @@
> +[Unit]
> +Description=Set PipeWire Default Audio Devices
> +After=wireplumber.service
> +Requires=wireplumber.service
> +
> +[Service]
> +Type=oneshot
> +ExecStart=/usr/bin/set-audio-defaults.sh
> +StandardOutput=append:/var/log/set-audio-defaults-output.log
> +StandardError=append:/var/log/set-audio-defaults-error.log
> +RemainAfterExit=yes
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/meta-arago-distro/recipes-multimedia/wireplumber/wireplumber/set-audio-defaults.sh b/meta-arago-distro/recipes-multimedia/wireplumber/wireplumber/set-audio-defaults.sh
> new file mode 100755
> index 00000000..83b89225
> --- /dev/null
> +++ b/meta-arago-distro/recipes-multimedia/wireplumber/wireplumber/set-audio-defaults.sh
> @@ -0,0 +1,30 @@
> +#!/bin/bash

You might want to consider making this script POSIX compatible avoiding any 
bashisms, if any, to not require bash as a dependency - it is GPLv3 and not 
everyone will be willing to add it to their product...


> +
> +# Wait for WirePlumber to be ready
> +for i in {1..30}; do
> +    wpctl status &>/dev/null && break
> +    sleep 1
> +done
> +
> +# Additional delay for nodes to appear
> +sleep 2
> +
> +# Find audio sink ID
> +SINK_ID=$(pw-cli info alsa_audio_sink 2>/dev/null | head -n 1 | awk '{print $2}')
> +if [[ -n "$SINK_ID" ]]; then
> +    wpctl set-default "$SINK_ID"
> +    echo "Set default sink to ID: $SINK_ID (alsa_audio_sink)"
> +else
> +    echo "Could not find alsa_audio_sink"
> +fi
> +
> +# Find audio source ID
> +SOURCE_ID=$(pw-cli info alsa_audio_source 2>/dev/null | head -n 1 | awk '{print $2}')
> +if [[ -n "$SOURCE_ID" ]]; then
> +    wpctl set-default "$SOURCE_ID"
> +    echo "Set default source to ID: $SOURCE_ID (alsa_audio_source)"
> +else
> +    echo "Could not find alsa_audio_source"
> +fi
> +
> +echo "Done"
> diff --git a/meta-arago-distro/recipes-multimedia/wireplumber/wireplumber_%.bbappend b/meta-arago-distro/recipes-multimedia/wireplumber/wireplumber_%.bbappend
> new file mode 100644
> index 00000000..9a697aa1
> --- /dev/null
> +++ b/meta-arago-distro/recipes-multimedia/wireplumber/wireplumber_%.bbappend

Same comment about guarding the bbappend of an upstream recipe.


> @@ -0,0 +1,27 @@
> +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
> +
> +SRC_URI += " \
> +    file://set-audio-defaults.sh \
> +    file://set-audio-defaults.service \
> +"
> +
> +inherit systemd
> +
> +do_install:append() {
> +    # Install the script
> +    install -d ${D}${bindir}
> +    install -m 0755 ${WORKDIR}/sources/set-audio-defaults.sh ${D}${bindir}/

Same comment about UNPACKDIR


> +    # Install the systemd service file
> +    install -d ${D}${systemd_system_unitdir}
> +    install -m 0644 ${WORKDIR}/sources/set-audio-defaults.service ${D}${systemd_system_unitdir}/

And here


> +}
> +
> +RDEPENDS:${PN} += "bash"
> +SYSTEMD_PACKAGES = "${PN}"
> +SYSTEMD_SERVICE:${PN} = "set-audio-defaults.service"
> +SYSTEMD_AUTO_ENABLE:${PN} = "enable"
> +
> +FILES:${PN} += " \
> +    ${bindir} \
> +"
> -- 
> 2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.