pulseaudio: add a systemd service that starts pulseaudio for the entire system
The default service only starts once per non-root user. Add a service that starts pulseaudio by default along with a wrapper script that sets the necessary environment variables before launching the daemon. https://jira.digi.com/browse/DEL-6746 Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
parent
7013acc439
commit
b30c5fa07e
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Export the XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS variables
|
||||
# prior to starting pulseaudio. XDG_RUNTIME_DIR is sourced from a
|
||||
# different file depending on the backend (xwayland or x11).
|
||||
[ -f "/etc/profile.d/weston.sh" ] && source /etc/profile.d/weston.sh
|
||||
[ -f "/etc/X11/Xsession.d/13xdgbasedirs.sh" ] && source /etc/X11/Xsession.d/13xdgbasedirs.sh
|
||||
|
||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
|
||||
|
||||
pulseaudio --start
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=System-wide sound service
|
||||
After=dbus.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/etc/pulseaudio-init
|
||||
ExecStop=kill -HUP $MAINPID
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -30,6 +30,8 @@ SRC_URI_append = " \
|
|||
${@oe.utils.conditional('SOUND_CARD', 'sgtl5000', '${CFG_SGTL5000}', '', d)} \
|
||||
${@oe.utils.conditional('SOUND_CARD', 'max98089', '${CFG_MAX98089}', '', d)} \
|
||||
${@oe.utils.conditional('AUDIO_HDMI', 'yes', '${CFG_HDMI}', '', d)} \
|
||||
file://pulseaudio-init \
|
||||
file://pulseaudio-system.service \
|
||||
"
|
||||
|
||||
SRC_URI_append_ccimx6ulsbc = " \
|
||||
|
|
@ -38,6 +40,11 @@ SRC_URI_append_ccimx6ulsbc = " \
|
|||
|
||||
EXTRA_OECONF_append_ccimx6 = " --disable-memfd"
|
||||
|
||||
FILES_${PN}-server_append = " ${systemd_unitdir}/* ${sysconfdir}/pulseaudio-init"
|
||||
|
||||
SYSTEMD_SERVICE_${PN}-server = "pulseaudio-system.service"
|
||||
SYSTEMD_PACKAGES = "${PN}-server"
|
||||
|
||||
do_install_append() {
|
||||
install -d ${D}${datadir}/pulseaudio/alsa-mixer/profile-sets
|
||||
install -m 0644 ${WORKDIR}/${SOUND_CARD}/dey-audio-*.conf ${D}${datadir}/pulseaudio/alsa-mixer/profile-sets
|
||||
|
|
@ -45,6 +52,12 @@ do_install_append() {
|
|||
install -d ${D}${base_libdir}/udev/rules.d
|
||||
install -m 0644 ${WORKDIR}/${SOUND_CARD}/90-pulseaudio.rules ${D}${base_libdir}/udev/rules.d
|
||||
|
||||
install -d ${D}${sysconfdir}
|
||||
install -m 0755 ${WORKDIR}/pulseaudio-init ${D}/${sysconfdir}
|
||||
|
||||
install -d ${D}${systemd_unitdir}/system
|
||||
install -m 0644 ${WORKDIR}/pulseaudio-system.service ${D}/${systemd_unitdir}/system
|
||||
|
||||
# Configuration files for HDMI sound card
|
||||
if [ "${AUDIO_HDMI}" = "yes" ]; then
|
||||
install -d ${D}${sysconfdir}/udev/scripts
|
||||
|
|
|
|||
Loading…
Reference in New Issue