Add configuration for the "cascaded setup" 07/30207/3
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Thu, 23 Oct 2014 10:27:54 +0000 (13:27 +0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Thu, 4 Dec 2014 17:28:50 +0000 (19:28 +0200)
If cascaded.pa is installed, then hardware should be managed by the
system instance, and user instances should use the hardware via the
system instance.

Change-Id: I6879bbcb50e131941c75b8c91a11e098d07428e5

src/Makefile.am
src/daemon/cascaded.pa [new file with mode: 0644]
src/daemon/default.pa.in
src/daemon/system.pa.in
src/daemon/tunnel-manager.conf [new file with mode: 0644]

index 232ee48..ae36726 100644 (file)
@@ -87,6 +87,7 @@ MODULE_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINOR@.la libpulsecommon-@PA_
 ###################################
 
 EXTRA_DIST = \
+               daemon/cascaded.pa \
                pulse/client.conf.in \
                pulse/version.h.in \
                tizen-ivi/audio-groups.conf \
@@ -110,6 +111,8 @@ EXTRA_DIST = \
                modules/echo-cancel/adrian-license.txt
 
 pulseconf_DATA = \
+               daemon/cascaded.pa \
+               daemon/tunnel-manager.conf \
                default.pa \
                system.pa \
                daemon.conf \
diff --git a/src/daemon/cascaded.pa b/src/daemon/cascaded.pa
new file mode 100644 (file)
index 0000000..ba5c415
--- /dev/null
@@ -0,0 +1,5 @@
+# This configuration file is included from default.pa to enable access to
+# hardware from the user instance via the system instance (i.e. "cascaded"
+# setup).
+
+load-module module-tunnel-manager
index 625be8f..34eee41 100755 (executable)
@@ -54,16 +54,17 @@ ifelse(@HAVE_MKFIFO@, 1, [dnl
 #load-module module-pipe-sink
 ])dnl
 
-### Automatically load driver modules depending on the hardware available
-ifelse(@HAVE_UDEV@, 1, [dnl
-.ifexists module-udev-detect@PA_SOEXT@
-load-module module-udev-detect
+### If cascaded.pa exists, then that file defines how ALSA and Bluetooth
+### devices for the user instance are loaded. Otherwise, we load the devices
+### in the normal way, i.e. by using module-udev-detect and
+### module-bluetooth-discover.
+### XXX: .ifexists is designed only for checking module existence, but when
+### using an absolute path, it happens to work for arbitrary files too.
+.ifexists /etc/pulse/cascaded.pa
+.include /etc/pulse/cascaded.pa
 .else
-], [dnl
-.ifexists module-detect@PA_SOEXT@
-])dnl
-### Use the static hardware detection module (for systems that lack udev support)
-load-module module-detect
+load-module module-udev-detect
+load-module module-bluetooth-discover
 .endif
 
 ### Automatically connect sink and source if JACK server is present
@@ -73,13 +74,6 @@ load-module module-jackdbus-detect
 .fail
 .endif
 
-ifelse(@HAVE_BLUEZ@, 1, [dnl
-### Automatically load driver modules for Bluetooth hardware
-.ifexists module-bluetooth-discover@PA_SOEXT@
-load-module module-bluetooth-discover
-.endif
-])dnl
-
 ifelse(@HAVE_AF_UNIX@, 1, [dnl
 ### Load several protocols
 #.ifexists module-esound-protocol-unix@PA_SOEXT@
@@ -175,7 +169,15 @@ ifelse(@HAVE_X11@, 1, [dnl
 .ifexists module-murphy-ivi@PA_SOEXT@
 load-module module-murphy-ivi
 load-module module-stream-restore restore_device=false on_hotplug=false on_rescue=false restore_volume=true preferred_stream_group=media.role.within.application.name
+
+# FIXME: This shouldn't be loaded if /etc/pulse/cascaded.pa exists, because in
+# that case the system instance is listening on the same port, so this will
+# fail. We can't use .ifexists here, because the support for nested conditional
+# sections remains unimplemented.
+.nofail
 load-module module-native-protocol-tcp listen=127.0.0.1
+.fail
+
 load-module module-volume-api
 load-module module-audio-groups
 load-module module-main-volume-policy
index 6da880e..424d3b1 100755 (executable)
 changequote(`[', `]')dnl Set up m4 quoting
 
 ### Automatically load driver modules depending on the hardware available
-ifelse(@HAVE_UDEV@, 1, [dnl
-.ifexists module-udev-detect@PA_SOEXT@
 load-module module-udev-detect
-.else
-], @HAVE_HAL@, 1, [dnl
-.ifexists module-hal-detect@PA_SOEXT@
-load-module module-hal-detect
-.else
-], [dnl
-.ifexists module-detect@PA_SOEXT@
-])dnl
-### Use the static hardware detection module (for systems that lack udev/hal support)
-load-module module-detect
-.endif
+load-module module-bluetooth-discover
 
-### Load several protocols
-.ifexists module-esound-protocol-unix@PA_SOEXT@
-load-module module-esound-protocol-unix
-.endif
-load-module module-native-protocol-unix
+### Enable access for any local user
+load-module module-native-protocol-unix auth-anonymous=true
+load-module module-native-protocol-tcp listen=127.0.0.1
 
 ### Automatically restore the volume of streams and devices
 load-module module-stream-restore
diff --git a/src/daemon/tunnel-manager.conf b/src/daemon/tunnel-manager.conf
new file mode 100644 (file)
index 0000000..81af59e
--- /dev/null
@@ -0,0 +1,5 @@
+[General]
+remote_device_tunnel_enabled_condition = !device.is_monitor && (!device.seat || seats.contains(device.seat))
+
+[RemoteServer system]
+address = /run/pulse/native