From 3888bfcccd8324d23a7bc31ebb2d8063d9da1aaf Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 22 Jul 2008 19:45:18 +0200 Subject: enable exit-on-idle by default --- src/daemon/daemon-conf.c | 2 +- src/daemon/daemon.conf.in | 2 +- src/daemon/default.pa.in | 27 ++++++++++++++------------- 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index 9ac40901..50b812dc 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -62,7 +62,7 @@ static const pa_daemon_conf default_conf = { .realtime_scheduling = FALSE, .realtime_priority = 5, /* Half of JACK's default rtprio */ .disallow_module_loading = FALSE, - .exit_idle_time = -1, + .exit_idle_time = 20, .module_idle_time = 20, .scache_idle_time = 20, .auto_log_target = 1, diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in index dfabcfb2..41c26e2a 100644 --- a/src/daemon/daemon.conf.in +++ b/src/daemon/daemon.conf.in @@ -32,7 +32,7 @@ ; realtime-scheduling = no ; realtime-priority = 5 -; exit-idle-time = -1 +; exit-idle-time = 20 ; module-idle-time = 20 ; scache-idle-time = 20 diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in index aad9f5d6..498499e7 100755 --- a/src/daemon/default.pa.in +++ b/src/daemon/default.pa.in @@ -80,14 +80,6 @@ load-module module-always-sink ### Automatically suspend sinks/sources that become idle for too long load-module module-suspend-on-idle -### Load X11 bell module -#load-module module-x11-bell sample=bell-windowing-system - -### Register ourselves in the X11 session manager -# Deactivated by default, to avoid deadlock when PA is started as esd from gnome-session -# Instead we load this via /etc/xdg/autostart/ and "pactl load-module" now -#load-module module-x11-xsmp - ### If autoexit on idle is enabled we want to make sure we only quit ### when no local session needs us anymore. load-module module-console-kit @@ -104,12 +96,21 @@ load-module module-gconf .fail .endif +# X11 modules should not be started from default.pa so that one daemon +# can be shared by multiple sessions. + +### Load X11 bell module +#load-module module-x11-bell sample=bell-windowing-system + +### Register ourselves in the X11 session manager +#load-module module-x11-xsmp + ### Publish connection data in the X11 root window -.ifexists module-x11-publish@PA_SOEXT@ -.nofail -load-module module-x11-publish -.fail -.endif +#.ifexists module-x11-publish@PA_SOEXT@ +#.nofail +#load-module module-x11-publish +#.fail +#.endif ### Make some devices default #set-default-sink output -- cgit From 5edbb57516835688b1a47a3e0813b3965b014db2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 22 Jul 2008 21:13:46 +0200 Subject: don't drop caps if we are started as normal root user --- src/daemon/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/daemon') diff --git a/src/daemon/main.c b/src/daemon/main.c index 14594416..553ed7d4 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -496,7 +496,7 @@ int main(int argc, char *argv[]) { if (conf->high_priority && (conf->cmd == PA_CMD_DAEMON || conf->cmd == PA_CMD_START)) pa_raise_priority(conf->nice_level); - if (pa_have_caps()) { + if (!real_root && pa_have_caps()) { pa_bool_t drop; drop = (conf->cmd != PA_CMD_DAEMON && conf->cmd != PA_CMD_START) || !conf->realtime_scheduling; -- cgit From e7b9da320993840f21f6208ba8a209865fca37ab Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 23 Jul 2008 22:46:39 +0200 Subject: add missing pieces for new startup logic --- src/daemon/pulseaudio-module-xsmp.desktop | 10 ---------- src/daemon/pulseaudio.desktop | 10 ++++++++++ src/daemon/start-pulseaudio-x11.in | 31 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 10 deletions(-) delete mode 100644 src/daemon/pulseaudio-module-xsmp.desktop create mode 100644 src/daemon/pulseaudio.desktop create mode 100755 src/daemon/start-pulseaudio-x11.in (limited to 'src/daemon') diff --git a/src/daemon/pulseaudio-module-xsmp.desktop b/src/daemon/pulseaudio-module-xsmp.desktop deleted file mode 100644 index fa719a73..00000000 --- a/src/daemon/pulseaudio-module-xsmp.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Version=1.0 -Encoding=UTF-8 -Name=PulseAudio Session Management -Comment=Load module-x11-xsmp into PulseAudio -Exec=pactl load-module module-x11-xsmp -Terminal=false -Type=Application -Categories= -GenericName= diff --git a/src/daemon/pulseaudio.desktop b/src/daemon/pulseaudio.desktop new file mode 100644 index 00000000..57a7a6e4 --- /dev/null +++ b/src/daemon/pulseaudio.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Encoding=UTF-8 +Name=PulseAudio Sound System +Comment=Start the PulseAudio Sound System +Exec=start-pulseaudio-x11 +Terminal=false +Type=Application +Categories= +GenericName= diff --git a/src/daemon/start-pulseaudio-x11.in b/src/daemon/start-pulseaudio-x11.in new file mode 100755 index 00000000..3cccc4dc --- /dev/null +++ b/src/daemon/start-pulseaudio-x11.in @@ -0,0 +1,31 @@ +#!/bin/sh + +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. + +set -e + +@PA_BINARY@ --start "$@" + +if [ x"$DISPLAY" != x ] ; then + + @PACTL_BINARY@ load-module module-x11-publish "display=$DISPLAY" > /dev/null + + if [ x"$SESSION_MANAGER" != x ] ; then + @PACTL_BINARY@ load-module module-x11-xsmp "display=$DISPLAY session_manager=$SESSION_MANAGER" > /dev/null + fi +fi -- cgit From b7b4b5e589f281c96e111ab64483893f030477e6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 30 Jul 2008 13:44:20 +0200 Subject: remove debug message --- src/daemon/main.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/main.c b/src/daemon/main.c index 553ed7d4..a8880a30 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -762,8 +762,6 @@ int main(int argc, char *argv[]) { /* If we are already running and with are run in * --start mode, then let's return this as success. */ - pa_log_info("z=%i rock!", z); - retval = 0; goto finish; } -- cgit From 881046b730125cdb24a5bd8fac9d18901c66b523 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 30 Jul 2008 16:59:30 +0200 Subject: install a default system.pa --- src/daemon/default.pa.in | 3 +++ src/daemon/system.pa.in | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100755 src/daemon/system.pa.in (limited to 'src/daemon') diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in index 498499e7..917fc309 100755 --- a/src/daemon/default.pa.in +++ b/src/daemon/default.pa.in @@ -16,6 +16,9 @@ # along with PulseAudio; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +# This startup script is used only if PulseAudio is started per-user +# (i.e. not in system mode) + .nofail ### Load something into the sample cache diff --git a/src/daemon/system.pa.in b/src/daemon/system.pa.in new file mode 100755 index 00000000..f6052c4b --- /dev/null +++ b/src/daemon/system.pa.in @@ -0,0 +1,54 @@ +#!@PA_BINARY@ -nF +# +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +# This startup script is used only if PulseAudio is started in system +# mode. + +### Automatically load driver modules depending on the hardware available +.ifexists module-hal-detect@PA_SOEXT@ +load-module module-hal-detect +.else +### Alternatively use the static hardware detection module (for systems that +### lack HAL support) +load-module module-detect +.endif + +### Load several protocols +.ifexists module-esound-protocol-unix@PA_SOEXT@ +load-module module-esound-protocol-unix +.endif +load-module module-native-protocol-unix + +### Automatically restore the volume of playback streams +load-module module-volume-restore + +### Automatically restore the default sink/source when changed by the user during runtime +load-module module-default-device-restore + +### Automatically move streams to the default sink if the sink they are +### connected to dies, similar for sources +load-module module-rescue-streams + +### Make sure we always have a sink around, even if it is a null sink. +load-module module-always-sink + +### Automatically suspend sinks/sources that become idle for too long +load-module module-suspend-on-idle + +### Enable positioned event sounds +load-module module-position-event-sounds -- cgit From 0b428e7cb1efdd7330b89a9855f08c45bfa98307 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 30 Jul 2008 20:36:34 +0200 Subject: don't allow --start in system mode --- src/daemon/main.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/daemon') diff --git a/src/daemon/main.c b/src/daemon/main.c index a8880a30..5fc9f01c 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -627,6 +627,11 @@ int main(int argc, char *argv[]) { goto finish; } + if (conf->cmd == PA_CMD_START && conf->system_instance) { + pa_log("--start not supported for system instances."); + goto finish; + } + if (conf->cmd == PA_CMD_START) { /* If we shall start PA only when it is not running yet, we * first take the autospawn lock to make things -- cgit From 026a6bdd0ecdc68288b2167aed6dfd4e6f407edb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 31 Jul 2008 01:25:33 +0200 Subject: Work around D-Bus bug that involves dbus_shutdown() to call exit() when it shouldn't. Patch from Coling Guthrie --- src/daemon/polkit.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/daemon') diff --git a/src/daemon/polkit.c b/src/daemon/polkit.c index 256e3199..dc0eee78 100644 --- a/src/daemon/polkit.c +++ b/src/daemon/polkit.c @@ -54,6 +54,11 @@ int pa_polkit_check(const char *action_id) { goto finish; } + /* There seems to be a bug in D-Bus that causes dbus_shutdown() to + * call exit() when a connection without this flag disabled was + * created during runtime.*/ + dbus_connection_set_exit_on_disconnect(bus, FALSE); + if (!(caller = polkit_caller_new_from_pid(bus, getpid(), &dbus_error))) { pa_log_error("Cannot get caller from PID: %s", dbus_error.message); goto finish; -- cgit From 4ccbc4dbe27b286b548ad27435c390131075fc8b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 31 Jul 2008 21:22:43 +0200 Subject: reword comment on dbus a bit --- src/daemon/polkit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/daemon') diff --git a/src/daemon/polkit.c b/src/daemon/polkit.c index dc0eee78..08155cf2 100644 --- a/src/daemon/polkit.c +++ b/src/daemon/polkit.c @@ -54,9 +54,9 @@ int pa_polkit_check(const char *action_id) { goto finish; } - /* There seems to be a bug in D-Bus that causes dbus_shutdown() to - * call exit() when a connection without this flag disabled was - * created during runtime.*/ + /* There seems to be a bug in some versions of D-Bus that causes + * dbus_shutdown() to call exit() when a connection without this + * flag disabled was created during runtime.*/ dbus_connection_set_exit_on_disconnect(bus, FALSE); if (!(caller = polkit_caller_new_from_pid(bus, getpid(), &dbus_error))) { -- cgit