monitors: enable libcamera by default and set priority on all camera nodes

Currently v4l2 nodes will get higher priority than libcamera ones.
The default can be changed, of course, with wpctl.

Things are still not great if a camera is enumerated by both monitors.
The first node to be linked will grab the device and the second one
from the other subsystem will fail to negotiate.
This commit is contained in:
George Kiagiadakis
2022-05-26 14:08:16 +03:00
parent 13b85bd4a2
commit 9ec2757d27
3 changed files with 22 additions and 0 deletions

View File

@@ -86,6 +86,20 @@ function createNode(parent, id, type, factory, properties)
-- sanitize description, replace ':' with ' '
properties["node.description"] = desc:gsub("(:)", " ")
-- set priority
if not properties["priority.session"] then
local location = properties["api.libcamera.location"]
local priority = 700
if location == "front" then
priority = priority + 150
elseif location == "external" then
priority = priority + 100
elseif location == "back" then
priority = priority + 50
end
properties["priority.session"] = priority
end
-- apply properties from config.rules
rulesApplyProperties(properties)