mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-04-21 11:20:40 +02:00
monitors: sanitize device names like media-session does
This commit is contained in:
parent
d28f1241cc
commit
47ed9bb527
3 changed files with 14 additions and 2 deletions
|
|
@ -188,7 +188,7 @@ function prepareDevice(parent, id, type, factory, properties)
|
|||
(properties["device.name"] or
|
||||
properties["device.bus-id"] or
|
||||
properties["device.bus-path"] or
|
||||
tostring(id))
|
||||
tostring(id)):gsub("([^%w_%-%.])", "_")
|
||||
|
||||
properties["device.name"] = name
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,18 @@ end
|
|||
function createDevice(parent, id, type, factory, properties)
|
||||
local device = parent:get_managed_object(id)
|
||||
if not device then
|
||||
-- ensure a proper device name
|
||||
local name =
|
||||
(properties["device.name"] or
|
||||
properties["api.bluez5.address"] or
|
||||
properties["device.description"] or
|
||||
tostring(id)):gsub("([^%w_%-%.])", "_")
|
||||
|
||||
if not name:find("^bluez_card%.", 1) then
|
||||
name = "bluez_card." .. name
|
||||
end
|
||||
properties["device.name"] = name
|
||||
|
||||
-- apply properties from config.rules
|
||||
rulesApplyProperties(properties)
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ function createDevice(parent, id, type, factory, properties)
|
|||
(properties["device.name"] or
|
||||
properties["device.bus-id"] or
|
||||
properties["device.bus-path"] or
|
||||
tostring(id))
|
||||
tostring(id)):gsub("([^%w_%-%.])", "_")
|
||||
|
||||
properties["device.name"] = name
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue