pulseaudio: launch pulseaudio in system mode

By launching in system mode it is possible to play music from a shell using
pulseaudio. With change all platforms and images (with or without graphical
support) have pulseaudio working.

https://onedigi.atlassian.net/browse/DEL-8417

Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
Tatiana Leon 2023-03-03 14:43:06 +01:00
parent e7b0a7affc
commit ef9e14ab5b
5 changed files with 6 additions and 21 deletions

View File

@ -5,7 +5,6 @@ if [ "$USER" == "root" ]; then
export ECORE_EVAS_ENGINE=wayland_shm
export ECORE_EVAS_ENGINE=wayland_shm
export GDK_BACKEND=wayland
export PULSE_RUNTIME_PATH=/run/user/`id -u root`
if [ -e $XDG_RUNTIME_DIR/wayland-0 ]; then
export WAYLAND_DISPLAY=wayland-0
else

View File

@ -17,8 +17,6 @@ readonly DEMOSERVER_BINARY="/srv/www/demoserver.py"
readonly STOP_TIMEOUT="5"
readonly PULSEAUDIO_START_COMMAND="pulseaudio --start"
[ -z "${XDG_RUNTIME_DIR}" ] && export XDG_RUNTIME_DIR=/run/user/$UID
stop_process() {
# try to stop gracefully
pkill -f "${1}" >/dev/null 2>&1

View File

@ -1,18 +1,4 @@
#!/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
[ -z ${UID} ] && export UID="$(id -u)"
[ -z "${XDG_RUNTIME_DIR}" ] && export XDG_RUNTIME_DIR=/run/user/$UID
export DBUS_SESSION_BUS_ADDRESS=unix:path=${XDG_RUNTIME_DIR}/bus
type journalctl >/dev/null 2>&1 && log_target=journal || log_target=syslog
pulseaudio --start --log-target="${log_target}"
# Create a symlink to the daemon's PID file in a more accesible directory
ln -sf ${XDG_RUNTIME_DIR}/pulse/pid /run/pulse.pid
pulseaudio --system --daemon --log-target="${log_target}"

View File

@ -4,7 +4,7 @@ After=dbus.service
[Service]
Type=forking
PIDFile=/run/pulse.pid
PIDFile=/run/pulse/pid
ExecStart=/etc/pulseaudio-init
ExecStop=kill -HUP $MAINPID

View File

@ -56,8 +56,8 @@ SRC_URI:append:mx9-nxp-bsp = " \
file://default.pa \
"
# Enable allow-autospawn-for-root as default
PACKAGECONFIG:append = " autospawn-for-root"
# Disable allow-autospawn-for-root as default
PACKAGECONFIG:remove = "autospawn-for-root"
EXTRA_OECONF:append:ccimx6 = " --disable-memfd"
@ -105,6 +105,8 @@ do_install:append() {
fi
sed -i -e '/load-module module-suspend-on-idle/{s,$, timeout=0,g}' ${D}${sysconfdir}/pulse/default.pa
sed -i -e '/load-module module-suspend-on-idle/{s,$, timeout=0,g}' ${D}${sysconfdir}/pulse/system.pa
sed -i -e '/load-module module-native-protocol-unix/{/ auth-anonymous=true/! s/$/ auth-anonymous=true/g}' ${D}${sysconfdir}/pulse/system.pa
}
# Pulse audio configuration files installation