Skip to content
Snippets Groups Projects
Commit 20c77336 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files
parent 7c1fc1c5
No related branches found
No related tags found
No related merge requests found
...@@ -134,8 +134,8 @@ function createNode(parent, id, type, factory, properties) ...@@ -134,8 +134,8 @@ function createNode(parent, id, type, factory, properties)
or dev_props["device.nick"] or dev_props["device.nick"]
or dev_props["api.alsa.card.name"] or dev_props["api.alsa.card.name"]
or dev_props["alsa.card_name"] or dev_props["alsa.card_name"]
-- also sanitize nick, but allow all characters except : -- also sanitize nick, replace ':' with ' '
properties["node.nick"] = nick:gsub("(:)", "_") properties["node.nick"] = nick:gsub("(:)", " ")
-- ensure the node has a description -- ensure the node has a description
if not properties["node.description"] then if not properties["node.description"] then
...@@ -143,14 +143,15 @@ function createNode(parent, id, type, factory, properties) ...@@ -143,14 +143,15 @@ function createNode(parent, id, type, factory, properties)
local name = properties["api.alsa.pcm.name"] or properties["api.alsa.pcm.id"] or dev local name = properties["api.alsa.pcm.name"] or properties["api.alsa.pcm.id"] or dev
if profile_desc then if profile_desc then
properties["node.description"] = desc .. " " .. profile_desc desc = desc .. " " .. profile_desc
elseif subdev == "0" then elseif subdev == "0" then
properties["node.description"] = desc .. " (" .. name .. " " .. subdev .. ")" desc = desc .. " (" .. name .. " " .. subdev .. ")"
elseif dev == "0" then elseif dev == "0" then
properties["node.description"] = desc .. " (" .. name .. ")" desc = desc .. " (" .. name .. ")"
else
properties["node.description"] = desc
end end
-- also sanitize description, replace ':' with ' '
properties["node.description"] = desc:gsub("(:)", " ")
end end
-- apply properties from config.rules -- apply properties from config.rules
......
...@@ -48,12 +48,14 @@ function createNode(parent, id, type, factory, properties) ...@@ -48,12 +48,14 @@ function createNode(parent, id, type, factory, properties)
properties["node.pause-on-idle"] = false properties["node.pause-on-idle"] = false
-- set the node description -- set the node description
properties["node.description"] = local desc =
dev_props["device.description"] dev_props["device.description"]
or dev_props["device.name"] or dev_props["device.name"]
or dev_props["device.nick"] or dev_props["device.nick"]
or dev_props["device.alias"] or dev_props["device.alias"]
or "bluetooth-device" or "bluetooth-device"
-- sanitize description, replace ':' with ' '
properties["node.description"] = desc:gsub("(:)", " ")
-- set the node name -- set the node name
local name = local name =
......
...@@ -67,7 +67,6 @@ function createNode(parent, id, type, factory, properties) ...@@ -67,7 +67,6 @@ function createNode(parent, id, type, factory, properties)
dev_props["device.nick"] or dev_props["device.nick"] or
dev_props["device.alias"] or dev_props["device.alias"] or
"v4l2-device") "v4l2-device")
-- sanitize name -- sanitize name
name = name:gsub("([^%w_%-%.])", "_") name = name:gsub("([^%w_%-%.])", "_")
...@@ -83,7 +82,9 @@ function createNode(parent, id, type, factory, properties) ...@@ -83,7 +82,9 @@ function createNode(parent, id, type, factory, properties)
end end
-- set the node description -- set the node description
properties["node.description"] = dev_props["device.description"] or "v4l2-device" local desc = dev_props["device.description"] or "v4l2-device"
-- sanitize description, replace ':' with ' '
properties["node.description"] = desc:gsub("(:)", " ")
-- apply properties from config.rules -- apply properties from config.rules
rulesApplyProperties(properties) rulesApplyProperties(properties)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment