config: make the monitor properties & rules available in global tables

This allows altering monitor properties or adding rules in different
lua files that get loaded before 90-enable*.lua
This commit is contained in:
George Kiagiadakis 2021-02-15 19:48:06 +02:00
parent 1d40e7713f
commit f2f889a3e0
5 changed files with 25 additions and 19 deletions

View file

@ -1,6 +1,8 @@
-- ALSA monitor config file --
local properties = {
alsa_monitor = {}
alsa_monitor.properties = {
-- Create a JACK device. This is not enabled by default because
-- it requires that the PipeWire JACK replacement libraries are
-- not used by the session manager, in order to be able to
@ -13,7 +15,7 @@ local properties = {
--["alsa.reserve.application-name"] = "WirePlumber",
}
local rules = {
alsa_monitor.rules = {
-- An array of matches/actions to evaluate.
{
-- Rules for matching a device or node. It is an array of
@ -96,14 +98,14 @@ local rules = {
}
}
function enable_alsa()
function alsa_monitor.enable()
-- The "reserve-device" module needs to be loaded for reservation to work
if properties["alsa.reserve"] then
if alsa_monitor.properties["alsa.reserve"] then
load_module("reserve-device")
end
load_monitor("alsa", {
properties = properties,
rules = rules,
properties = alsa_monitor.properties,
rules = alsa_monitor.rules,
})
end

View file

@ -1,6 +1,8 @@
-- Bluez monitor config file --
local properties = {
bluez_monitor = {}
bluez_monitor.properties = {
-- MSBC is not expected to work on all headset + adapter combinations.
--["bluez5.msbc-support"] = true,
--["bluez5.sbc-xq-support"] = true,
@ -19,7 +21,7 @@ local properties = {
--["bluez5.codecs"] = "[ sbc aac ldac aptx aptx_hd ]",
}
local rules = {
bluez_monitor.rules = {
-- An array of matches/actions to evaluate.
{
-- Rules for matching a device or node. It is an array of
@ -59,9 +61,9 @@ local rules = {
},
}
function enable_bluetooth()
function bluez_monitor.enable()
load_monitor("bluez5", {
properties = properties,
rules = rules,
properties = bluez_monitor.properties,
rules = bluez_monitor.rules,
})
end

View file

@ -1,8 +1,10 @@
-- V4L2 monitor config file --
local properties = { }
v4l2_monitor = {}
local rules = {
v4l2_monitor.properties = { }
v4l2_monitor.rules = {
-- An array of matches/actions to evaluate.
{
-- Rules for matching a device or node. It is an array of
@ -39,9 +41,9 @@ local rules = {
},
}
function enable_v4l2()
function v4l2_monitor.enable()
load_monitor("v4l2", {
properties = properties,
rules = rules,
properties = v4l2_monitor.properties,
rules = v4l2_monitor.rules,
})
end

View file

@ -1,3 +1,3 @@
enable_audio()
enable_alsa()
enable_bluetooth()
alsa_monitor.enable()
bluez_monitor.enable()

View file

@ -1 +1 @@
enable_v4l2()
v4l2_monitor.enable()