fab9ac0e4dc27836e88b988e161d272ea557db55
[AGL/meta-agl.git] / meta-pipewire / recipes-multimedia / wireplumber / wireplumber-config-agl / 30-bluez-monitor.lua
1 -- Bluez monitor config file --
2
3 bluez_monitor = {}
4
5 bluez_monitor.properties = {
6   -- Enable mSBC support, disabled by default. Be aware that
7   -- mSBC is not expected to work on all headset + adapter combinations.
8   -- This can be overloaded for a specific device and native backend
9   -- in rules section.
10   --["bluez5.msbc-support"] = false,
11
12   --["bluez5.sbc-xq-support"] = true,
13
14   -- Enabled headset roles (default: [ hsp_hs hfp_ag ]), this
15   -- property only applies to native backend. Currently some headsets
16   -- (Sony WH-1000XM3) are not working with both hsp_ag and hfp_ag
17   -- enabled, disable either hsp_ag or hfp_ag to work around it.
18   --
19   -- Supported headset roles: hsp_hs (HSP Headset),
20   --                          hsp_ag (HSP Audio Gateway),
21   --                          hfp_hf (HFP Hands-Free),
22   --                          hfp_ag (HFP Audio Gateway)
23   ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]",
24
25   -- Enabled A2DP codecs (default: all).
26   --["bluez5.codecs"] = "[ sbc aac ldac aptx aptx_hd ]",
27
28   -- Properties for the A2DP codec configuration
29   --["bluez5.default.rate"] = 48000,
30   --["bluez5.default.channels"] = 2,
31 }
32
33 bluez_monitor.rules = {
34   -- An array of matches/actions to evaluate.
35   {
36     -- Rules for matching a device or node. It is an array of
37     -- properties that all need to match the regexp. If any of the
38     -- matches work, the actions are executed for the object.
39     matches = {
40       {
41         -- This matches all cards.
42         { "device.name", "matches", "bluez_card.*" },
43       },
44     },
45     -- Apply properties on the matched object.
46     apply_properties = {
47       -- Auto-connect device profiles on start up or when only partial
48       -- profiles have connected. Disabled by default if the property
49       -- is not specified.
50       --["bluez5.auto-connect"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]",
51       ["bluez5.auto-connect"]  = "[ hfp_hf hsp_hs a2dp_sink ]",
52
53       -- Overload mSBC support for native backend and a specific device.
54       --["bluez5.msbc-support"] = false,
55
56       -- Hardware volume control (default: [ hfp_ag hsp_ag a2dp_source ])
57       --["bluez5.hw-volume"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]",
58
59       -- LDAC encoding quality
60       -- Available values: auto (Adaptive Bitrate, default)
61       --                   hq   (High Quality, 990/909kbps)
62       --                   sq   (Standard Quality, 660/606kbps)
63       --                   mq   (Mobile use Quality, 330/303kbps)
64       --["bluez5.a2dp.ldac.quality"] = "auto",
65
66       -- AAC variable bitrate mode
67       -- Available values: 0 (cbr, default), 1-5 (quality level)
68       --["bluez5.a2dp.aac.bitratemode"] = 0,
69
70       -- Profile connected first
71       -- Available values: a2dp-sink (default), headset-head-unit
72       --["device.profile"] = "a2dp-sink",
73     },
74   },
75   {
76     -- Make output hsp/hfp stream nodes go through the Communication endpoint
77     -- Unfortunately we cannot match on "media.class" because this property
78     -- is not known before the node is created
79     matches = {
80       {
81         { "api.bluez5.profile", "equals", "headset-audio-gateway" },
82         { "factory.name", "matches", "*source*" },
83       },
84     },
85     apply_properties = {
86       ["media.role"]  = "Communication",
87     },
88   },
89   {
90     -- Make output a2dp stream nodes go through the Multimedia endpoint
91     -- Unfortunately we cannot match on "media.class" because this property
92     -- is not known before the node is created
93     matches = {
94       {
95         { "api.bluez5.profile", "equals", "a2dp-source" },
96       },
97     },
98     apply_properties = {
99       ["media.role"]  = "Multimedia",
100     },
101   },
102 }
103
104 function bluez_monitor.enable()
105   load_monitor("bluez", {
106     properties = bluez_monitor.properties,
107     rules = bluez_monitor.rules,
108   })
109 end