diff --git a/src/config/wireplumber.conf.d/access.conf b/src/config/wireplumber.conf.d/access.conf index 931e0c04..93084118 100644 --- a/src/config/wireplumber.conf.d/access.conf +++ b/src/config/wireplumber.conf.d/access.conf @@ -16,9 +16,11 @@ wireplumber.settings = { media.category = "Manager" } ] - update-props = { - access = "flatpak-manager" - default_permissions = "all", + actions = { + update-props = { + access = "flatpak-manager" + default_permissions = "all", + } } } { @@ -27,8 +29,10 @@ wireplumber.settings = { access = "flatpak" } ] - update-props = { - default_permissions = "rx" + actions = { + update-props = { + default_permissions = "rx" + } } } { @@ -37,8 +41,10 @@ wireplumber.settings = { access = "restricted" } ] - update-props = { - default_permissions = "rx" + actions = { + update-props = { + default_permissions = "rx" + } } } { @@ -47,8 +53,10 @@ wireplumber.settings = { access = "default" } ] - update-props = { - default_permissions = "all" + actions = { + update-props = { + default_permissions = "all" + } } } ] diff --git a/src/config/wireplumber.conf.d/alsa.conf b/src/config/wireplumber.conf.d/alsa.conf index 08f3da43..1f752176 100644 --- a/src/config/wireplumber.conf.d/alsa.conf +++ b/src/config/wireplumber.conf.d/alsa.conf @@ -59,9 +59,11 @@ monitor.alsa.rules = [ # device.name = "~alsa_card.*" # } # ] - # update-props = { - # api.alsa.use-acp = true - # api.acp.auto-port = false + # actions = { + # update-props = { + # api.alsa.use-acp = true + # api.acp.auto-port = false + # } # } # } @@ -73,46 +75,48 @@ monitor.alsa.rules = [ # device.name = "~alsa_card.*" # } # ] - # update-props = { - # ## Use ALSA-Card-Profile devices. They use UCM or the profile - # ## configuration to configure the device and mixer settings. - # api.alsa.use-acp = false + # actions = { + # update-props = { + # ## Use ALSA-Card-Profile devices. They use UCM or the profile + # ## configuration to configure the device and mixer settings. + # api.alsa.use-acp = false # - # ## Use UCM instead of profile when available. Can be - # ## disabled to skip trying to use the UCM profile. - # api.alsa.use-ucm = false + # ## Use UCM instead of profile when available. Can be + # ## disabled to skip trying to use the UCM profile. + # api.alsa.use-ucm = false # - # ## Don't use the hardware mixer for volume control. It - # ## will only use software volume. The mixer is still used - # ## to mute unused paths based on the selected port. - # api.alsa.soft-mixer = false + # ## Don't use the hardware mixer for volume control. It + # ## will only use software volume. The mixer is still used + # ## to mute unused paths based on the selected port. + # api.alsa.soft-mixer = false # - # ## Ignore decibel settings of the driver. Can be used to - # ## work around buggy drivers that report wrong values. - # api.alsa.ignore-dB = false + # ## Ignore decibel settings of the driver. Can be used to + # ## work around buggy drivers that report wrong values. + # api.alsa.ignore-dB = false # - # ## The profile set to use for the device. Usually this is - # ## "default.conf" but can be changed with a udev rule or here. - # device.profile-set = "profileset-name" + # ## The profile set to use for the device. Usually this is + # ## "default.conf" but can be changed with a udev rule or here. + # device.profile-set = "profileset-name" # - # ## The default active profile. Is by default set to "Off". - # device.profile = "default profile name" + # ## The default active profile. Is by default set to "Off". + # device.profile = "default profile name" # - # ## Automatically select the best profile. This is the - # ## highest priority available profile. This is disabled - # ## here and instead implemented in the session manager - # ## where it can save and load previous preferences. - # api.acp.auto-profile = false + # ## Automatically select the best profile. This is the + # ## highest priority available profile. This is disabled + # ## here and instead implemented in the session manager + # ## where it can save and load previous preferences. + # api.acp.auto-profile = false # - # ## Automatically switch to the highest priority available port. - # ## This is disabled here and implemented in the session manager instead. - # api.acp.auto-port = true + # ## Automatically switch to the highest priority available port. + # ## This is disabled here and implemented in the session manager instead. + # api.acp.auto-port = true # - # ## Other properties can be set here. - # device.nick = "My Device" + # ## Other properties can be set here. + # device.nick = "My Device" # - # ## Whether to disable the device or not - # device.disabled = false + # ## Whether to disable the device or not + # device.disabled = false + # } # } # } @@ -128,49 +132,51 @@ monitor.alsa.rules = [ # node.name = "~alsa_output.*" # } # ] - # update-props = { - # node.nick = "My Node" - # node.description = "My Node Description" - # priority.driver = 100 - # priority.session = 100 - # node.pause-on-idle = false - # monitor.channel-volumes = false - # resample.quality = 4 - # resample.disable = false - # channelmix.normalize = false - # channelmix.mix-lfe = false - # channelmix.upmix = true + # actions = { + # update-props = { + # node.nick = "My Node" + # node.description = "My Node Description" + # priority.driver = 100 + # priority.session = 100 + # node.pause-on-idle = false + # monitor.channel-volumes = false + # resample.quality = 4 + # resample.disable = false + # channelmix.normalize = false + # channelmix.mix-lfe = false + # channelmix.upmix = true # - # ## only "psd", "none" or "simple" values are accepted - # channelmix.upmix-method = "psd" + # ## only "psd", "none" or "simple" values are accepted + # channelmix.upmix-method = "psd" # - # channelmix.lfe-cutoff = 150 - # channelmix.fc-cutoff = 12000 - # channelmix.rear-delay = 12.0 - # channelmix.stereo-widen = 0.0 - # channelmix.hilbert-taps = 0 - # channelmix.disable = false - # dither.noise = 0 - # dither.method = "none" - # audio.channels = 2 - # audio.format = "S16LE" - # audio.rate = 44100 - # audio.allowed-rates = "32000,96000" - # audio.position = "FLFR" - # api.alsa.period-size = 1024 - # api.alsa.period-num = 2 - # api.alsa.headroom = 0 - # api.alsa.start-delay = 0 - # api.alsa.disable-mmap = false - # api.alsa.disable-batch = false - # api.alsa.use-chmap = false - # api.alsa.multirate = true - # latency.internal.rate = 0 - # latency.internal.ns = 0 - # clock.name = "api.alsa.0" + # channelmix.lfe-cutoff = 150 + # channelmix.fc-cutoff = 12000 + # channelmix.rear-delay = 12.0 + # channelmix.stereo-widen = 0.0 + # channelmix.hilbert-taps = 0 + # channelmix.disable = false + # dither.noise = 0 + # dither.method = "none" + # audio.channels = 2 + # audio.format = "S16LE" + # audio.rate = 44100 + # audio.allowed-rates = "32000,96000" + # audio.position = "FLFR" + # api.alsa.period-size = 1024 + # api.alsa.period-num = 2 + # api.alsa.headroom = 0 + # api.alsa.start-delay = 0 + # api.alsa.disable-mmap = false + # api.alsa.disable-batch = false + # api.alsa.use-chmap = false + # api.alsa.multirate = true + # latency.internal.rate = 0 + # latency.internal.ns = 0 + # clock.name = "api.alsa.0" # - # ## 0 disables suspend - # session.suspend-timeout-seconds = 5 + # ## 0 disables suspend + # session.suspend-timeout-seconds = 5 + # } # } # } ] diff --git a/src/config/wireplumber.conf.d/bluetooth.conf b/src/config/wireplumber.conf.d/bluetooth.conf index 0883290b..b812531c 100644 --- a/src/config/wireplumber.conf.d/bluetooth.conf +++ b/src/config/wireplumber.conf.d/bluetooth.conf @@ -102,8 +102,10 @@ monitor.bluetooth.rules = [ # device.name = "~bluez_card.*" # } # ] - # update-props = { - # bluez5.auto-connect = "[ hfp_hf hsp_hs a2dp_sink ]" + # actions = { + # update-props = { + # bluez5.auto-connect = "[ hfp_hf hsp_hs a2dp_sink ]" + # } # } # } @@ -115,33 +117,35 @@ monitor.bluetooth.rules = [ # device.name = "~bluez_card.*" # } # ] - # update-props = { - # ## Auto-connect device profiles on start up or when only partial - # ## profiles have connected. Disabled by default if the property - # ## is not specified. - # bluez5.auto-connect = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]" + # actions = { + # update-props = { + # ## Auto-connect device profiles on start up or when only partial + # ## profiles have connected. Disabled by default if the property + # ## is not specified. + # bluez5.auto-connect = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]" # - # ## Hardware volume control (default: [ hfp_ag hsp_ag a2dp_source ]) - # bluez5.hw-volume = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]" + # ## Hardware volume control (default: [ hfp_ag hsp_ag a2dp_source ]) + # bluez5.hw-volume = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]" # - # ## LDAC encoding quality - # ## Available values: auto (Adaptive Bitrate, default) - # ## hq (High Quality, 990/909kbps) - # ## sq (Standard Quality, 660/606kbps) - # ## mq (Mobile use Quality, 330/303kbps) - # bluez5.a2dp.ldac.quality = "auto" + # ## LDAC encoding quality + # ## Available values: auto (Adaptive Bitrate, default) + # ## hq (High Quality, 990/909kbps) + # ## sq (Standard Quality, 660/606kbps) + # ## mq (Mobile use Quality, 330/303kbps) + # bluez5.a2dp.ldac.quality = "auto" # - # ## AAC variable bitrate mode - # ## Available values: 0 (cbr, default), 1-5 (quality level) - # bluez5.a2dp.aac.bitratemode = 0 + # ## AAC variable bitrate mode + # ## Available values: 0 (cbr, default), 1-5 (quality level) + # bluez5.a2dp.aac.bitratemode = 0 # - # ## Profile connected first - # ## Available values: a2dp-sink (default), headset-head-unit - # device.profile = "a2dp-sink" + # ## Profile connected first + # ## Available values: a2dp-sink (default), headset-head-unit + # device.profile = "a2dp-sink" # - # ## Opus Pro Audio encoding mode: audio, voip, lowdelay - # bluez5.a2dp.opus.pro.application = "audio" - # bluez5.a2dp.opus.pro.bidi.application = "audio" + # ## Opus Pro Audio encoding mode: audio, voip, lowdelay + # bluez5.a2dp.opus.pro.application = "audio" + # bluez5.a2dp.opus.pro.bidi.application = "audio" + # } # } # } @@ -157,21 +161,23 @@ monitor.bluetooth.rules = [ # node.name = "~bluez_output.*" # } # ] - # update-props = { - # node.nick = "My Node" - # priority.driver = 100 - # priority.session = 100 - # node.pause-on-idle = false - # resample.quality = 4 - # channelmix.normalize = false - # channelmix.mix-lfe = false - # session.suspend-timeout-seconds = 5 - # monitor.channel-volumes = false + # actions = { + # update-props = { + # node.nick = "My Node" + # priority.driver = 100 + # priority.session = 100 + # node.pause-on-idle = false + # resample.quality = 4 + # channelmix.normalize = false + # channelmix.mix-lfe = false + # session.suspend-timeout-seconds = 5 + # monitor.channel-volumes = false # - # ## Media source role, "input" or "playback" - # ## Defaults to "playback", playing stream to speakers - # ## Set to "input" to use as an input for apps - # bluez5.media-source-role = "input" + # ## Media source role, "input" or "playback" + # ## Defaults to "playback", playing stream to speakers + # ## Set to "input" to use as an input for apps + # bluez5.media-source-role = "input" + # } # } # } ] @@ -188,13 +194,15 @@ monitor.bluetooth-midi.rules = [ # node.name = "~bluez_midi*" # } # ] - # update-props = { - # node.nick = "My Node" - # priority.driver = 100 - # priority.session = 100 - # node.pause-on-idle = false - # session.suspend-timeout-seconds = 5 - # monitor.channel-volumes = false + # actions = { + # update-props = { + # node.nick = "My Node" + # priority.driver = 100 + # priority.session = 100 + # node.pause-on-idle = false + # session.suspend-timeout-seconds = 5 + # monitor.channel-volumes = false + # } # } # } ] diff --git a/src/config/wireplumber.conf.d/libcamera.conf b/src/config/wireplumber.conf.d/libcamera.conf index a9ddf679..89a2b827 100644 --- a/src/config/wireplumber.conf.d/libcamera.conf +++ b/src/config/wireplumber.conf.d/libcamera.conf @@ -20,8 +20,10 @@ monitor.libcamera.rules = [ # device.name = "~libcamera_device.*" # } # ] - # update-props = { - # device.nick = "My Device" + # actions = { + # update-props = { + # device.nick = "My Device" + # } # } # } @@ -37,11 +39,13 @@ monitor.libcamera.rules = [ # node.name = "~libcamera_output.*" # } # ] - # update-props = { - # node.nick = "My Node" - # priority.driver = 100 - # priority.session = 100 - # node.pause-on-idle = false + # actions = { + # update-props = { + # node.nick = "My Node" + # priority.driver = 100 + # priority.session = 100 + # node.pause-on-idle = false + # } # } # } ] diff --git a/src/config/wireplumber.conf.d/stream.conf b/src/config/wireplumber.conf.d/stream.conf index 80b1113b..d1cfbd65 100644 --- a/src/config/wireplumber.conf.d/stream.conf +++ b/src/config/wireplumber.conf.d/stream.conf @@ -32,10 +32,12 @@ stream.rules = [ # ## Matches all devices # { application.name = "pw-play" } # ] - # update-props = { - # state.restore-props = false - # state.restore-target = false - # state.default-channel-volume = 1.0 + # actions = { + # update-props = { + # state.restore-props = false + # state.restore-target = false + # state.default-channel-volume = 1.0 + # } # } # } ] diff --git a/src/config/wireplumber.conf.d/v4l2.conf b/src/config/wireplumber.conf.d/v4l2.conf index 6f4420d0..477d0b0b 100644 --- a/src/config/wireplumber.conf.d/v4l2.conf +++ b/src/config/wireplumber.conf.d/v4l2.conf @@ -15,8 +15,10 @@ monitor.v4l2.rules = [ # device.name = "~v4l2_device.*" # } # ] - # update-props = { - # device.nick = "My Device" + # actions = { + # update-props = { + # device.nick = "My Device" + # } # } # } @@ -32,11 +34,13 @@ monitor.v4l2.rules = [ # node.name = "~v4l2_output.*" # } # ] - # update-props = { - # node.nick = "My Node" - # priority.driver = 100 - # priority.session = 100 - # node.pause-on-idle = false + # actions = { + # update-props = { + # node.nick = "My Node" + # priority.driver = 100 + # priority.session = 100 + # node.pause-on-idle = false + # } # } # } ] diff --git a/src/scripts/client/access-default.lua b/src/scripts/client/access-default.lua index d3c7301b..415b57ce 100644 --- a/src/scripts/client/access-default.lua +++ b/src/scripts/client/access-default.lua @@ -43,8 +43,10 @@ function getDefaultPermissions (properties) end function getPermissions (properties) - local matched, mprops = Conf.apply_rules ("access.rules", properties) - if (matched and mprops["default_permissions"]) then + local section = Conf.get_section ("access.rules") + local matched, mprops = JsonUtils.match_rules_update_properties ( + section, properties) + if (matched > 0 and mprops["default_permissions"]) then return mprops["default_permissions"], mprops["access"] end diff --git a/src/scripts/lib/common-utils.lua b/src/scripts/lib/common-utils.lua index 4f0621c2..b6715786 100644 --- a/src/scripts/lib/common-utils.lua +++ b/src/scripts/lib/common-utils.lua @@ -72,15 +72,15 @@ function cutils.get_default_metadata_object () end function cutils.evaluateRulesApplyProperties (properties, name) - local matched, mprops = Conf.apply_rules (name, properties) + local section = Conf.get_section (name) + local matched, mprops = JsonUtils.match_rules_update_properties ( + section, properties) - if (matched and mprops) then + if (matched > 0 and mprops) then for k, v in pairs (mprops) do properties [k] = v end end - - return matched and mprops end -- simple serializer {"foo", "bar"} -> "foo;bar;" diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua index 8fe8438c..bd026946 100644 --- a/src/scripts/monitors/alsa.lua +++ b/src/scripts/monitors/alsa.lua @@ -268,11 +268,9 @@ function prepareDevice(parent, id, obj_type, factory, properties) end -- apply properties from rules defined in JSON .conf file - local applied = cutils.evaluateRulesApplyProperties (properties, - "monitor.alsa.rules") - if not applied then - applyDefaultDeviceProperties (properties) - end + applyDefaultDeviceProperties (properties) + cutils.evaluateRulesApplyProperties (properties, "monitor.alsa.rules") + if properties ["device.disabled"] then device_names_table [properties ["device.name"]] = nil return