From 989708a8808567a4d53219bb208db45319e63137 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis <george.kiagiadakis@collabora.com> Date: Fri, 12 Feb 2021 17:38:40 +0200 Subject: [PATCH] config: immitate media-session's bluez-monitor.conf --- src/config/config.lua | 9 --- src/config/config.lua.d/30-bluez-monitor.lua | 67 +++++++++++++++++++ .../config.lua.d/90-enable-audio-all.lua | 2 + 3 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 src/config/config.lua.d/30-bluez-monitor.lua create mode 100644 src/config/config.lua.d/90-enable-audio-all.lua diff --git a/src/config/config.lua b/src/config/config.lua index a6814afd..a54bafea 100644 --- a/src/config/config.lua +++ b/src/config/config.lua @@ -99,10 +99,6 @@ function enable_audio() }) end -function enable_bluetooth() - load_monitor("bluez5") -end - function enable_endpoints() load_script("static-sessions.lua", { ["audio"] = {}, @@ -112,10 +108,5 @@ function enable_endpoints() load_script("policy-endpoint.lua") end --- split these calls into .lua files in config.lua.d/ --- to get a similar effect as the 'with-audio', 'with-pusleaudio', etc --- flag files that ship with pipewire-media-session enable_access() -enable_audio() -enable_bluetooth() enable_endpoints() diff --git a/src/config/config.lua.d/30-bluez-monitor.lua b/src/config/config.lua.d/30-bluez-monitor.lua new file mode 100644 index 00000000..7cb2e530 --- /dev/null +++ b/src/config/config.lua.d/30-bluez-monitor.lua @@ -0,0 +1,67 @@ +-- Bluez monitor config file -- + +local properties = { + -- MSBC is not expected to work on all headset + adapter combinations. + --["bluez5.msbc-support"] = true, + --["bluez5.sbc-xq-support"] = true, + + -- Enabled headset roles (default: [ hsp_hs hfp_ag ]), this + -- property only applies to native backend. Currently some headsets + -- (Sony WH-1000XM3) are not working with both hsp_ag and hfp_ag + -- enabled, disable either hsp_ag or hfp_ag to work around it. + -- + -- Supported headset roles: hsp_hs (HSP Headset), + -- hsp_ag (HSP Audio Gateway), + -- hfp_ag (HFP Audio Gateway) + --["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_ag ]", + + -- Enabled A2DP codecs (default: all). + --["bluez5.codecs"] = "[ sbc aac ldac aptx aptx_hd ]", +} + +local rules = { + -- An array of matches/actions to evaluate. + { + -- Rules for matching a device or node. It is an array of + -- properties that all need to match the regexp. If any of the + -- matches work, the actions are executed for the object. + matches = { + { + -- This matches all cards. + { "device.name", "matches", "bluez_card.*" }, + }, + }, + -- Apply properties on the matched object. + apply_properties = { + -- ["device.nick"] = "My Device", + }, + }, + { + matches = { + { + -- Matches all sources. + { "node.name", "matches", "bluez_input.*" }, + }, + { + -- Matches all sinks. + { "node.name", "matches", "bluez_output.*" }, + }, + }, + apply_properties = { + --["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, + }, + }, +} + +function enable_bluetooth() + load_monitor("bluez5", { + properties = properties, + rules = rules, + }) +end diff --git a/src/config/config.lua.d/90-enable-audio-all.lua b/src/config/config.lua.d/90-enable-audio-all.lua new file mode 100644 index 00000000..93e75dcf --- /dev/null +++ b/src/config/config.lua.d/90-enable-audio-all.lua @@ -0,0 +1,2 @@ +enable_audio() +enable_bluetooth() -- GitLab