mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-03 21:58:08 +02:00
monitor-alsa: fix node description on strange embedded devices
Ensure that no part of the description string is empty, otherwise fall back Fix logic with dev and/or subdev being 0
This commit is contained in:
parent
beb9902589
commit
98151fdb69
1 changed files with 9 additions and 4 deletions
|
|
@ -51,6 +51,10 @@ function findDuplicate(parent, id, property, value)
|
|||
return false
|
||||
end
|
||||
|
||||
function nonempty(str)
|
||||
return str ~= "" and str or nil
|
||||
end
|
||||
|
||||
function createNode(parent, id, type, factory, properties)
|
||||
local dev_props = parent.properties
|
||||
|
||||
|
|
@ -139,14 +143,15 @@ function createNode(parent, id, type, factory, properties)
|
|||
|
||||
-- ensure the node has a description
|
||||
if not properties["node.description"] then
|
||||
local desc = dev_props["device.description"] or "unknown"
|
||||
local name = properties["api.alsa.pcm.name"] or properties["api.alsa.pcm.id"] or dev
|
||||
local desc = nonempty(dev_props["device.description"]) or "unknown"
|
||||
local name = nonempty(properties["api.alsa.pcm.name"]) or
|
||||
nonempty(properties["api.alsa.pcm.id"]) or dev
|
||||
|
||||
if profile_desc then
|
||||
desc = desc .. " " .. profile_desc
|
||||
elseif subdev == "0" then
|
||||
elseif subdev ~= "0" then
|
||||
desc = desc .. " (" .. name .. " " .. subdev .. ")"
|
||||
elseif dev == "0" then
|
||||
elseif dev ~= "0" then
|
||||
desc = desc .. " (" .. name .. ")"
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue