bluez: use device id instead of profile name in node names

Don't include profile name in node names for HFP and A2DP.  Instead,
append the id number from the spa.bluez5 backend.  The backend takes
care of choosing the unique id numbers appropriately.

This makes the sink/source names the same for A2DP and HFP.  This allows
outputs directed to the Bluetooth device to remain there when switching
profiles between A2DP and HFP, without needing to determine the new
sink/source name.
This commit is contained in:
Pauli Virtanen 2022-07-11 18:19:03 +03:00 committed by George Kiagiadakis
parent cafb048e70
commit 40e7ad5ccc

View file

@ -62,7 +62,7 @@ function createNode(parent, id, type, factory, properties)
((factory:find("sink") and "bluez_output") or
(factory:find("source") and "bluez_input" or factory)) .. "." ..
(properties["api.bluez5.address"] or dev_props["device.name"]) .. "." ..
(properties["api.bluez5.profile"] or "unknown")
tostring(id)
-- sanitize name
properties["node.name"] = name:gsub("([^%w_%-%.])", "_")