scripts: fix minor issues with smart filters policy
The filter's destination target was not being found properly due to iterating the matching rules table with ipairs instead of pairs... the later is meant to be used with JSON objects. In addition, the filters were not being re-evaluated and linked properly when a device node was removed, this is because of a typo in the find-best-target.lua script. See #501
This commit is contained in:
@@ -95,7 +95,7 @@ local function getFilterTarget (metadata, node, om)
|
||||
end
|
||||
|
||||
-- Make sure the target node properties match all rules
|
||||
for key, val in ipairs(match_rules) do
|
||||
for key, val in pairs(match_rules) do
|
||||
if n_target.properties[key] ~= val then
|
||||
goto skip_target
|
||||
end
|
||||
@@ -381,7 +381,7 @@ function module.get_filter_from_target (direction, si_target)
|
||||
if v.direction == direction and
|
||||
v.enabled and
|
||||
v.target ~= nil and
|
||||
v.target.id == target.id then
|
||||
v.target.id == si_target.id then
|
||||
return v.main_si
|
||||
end
|
||||
end
|
||||
|
@@ -44,7 +44,7 @@ SimpleEventHook {
|
||||
} do
|
||||
local target_props = target.properties
|
||||
local target_node_id = target_props ["node.id"]
|
||||
local si_target_node = si:get_associated_proxy ("node")
|
||||
local si_target_node = target:get_associated_proxy ("node")
|
||||
local si_target_link_group = si_target_node.properties ["node.link-group"]
|
||||
local priority = tonumber (target_props ["priority.session"]) or 0
|
||||
|
||||
|
@@ -151,7 +151,6 @@ SimpleEventHook {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "c", "session-item-added", "session-item-removed" },
|
||||
Constraint { "event.session-item.interface", "=", "linkable" },
|
||||
Constraint { "item.factory.name", "c", "si-audio-adapter", "si-node", "si-audio-virtual" },
|
||||
},
|
||||
-- on device Routes changed
|
||||
EventInterest {
|
||||
|
Reference in New Issue
Block a user