From 7bca8cacde341294e4381f77a30c842cd0667135 Mon Sep 17 00:00:00 2001 From: Ashok Sidipotu Date: Thu, 20 Jul 2023 16:25:35 +0530 Subject: [PATCH] camera monitors: pass device and node properties as event data This avoids event properties show up in device and node properties. --- src/scripts/monitors/libcamera/enumerate-device.lua | 3 ++- src/scripts/monitors/libcamera/name-device.lua | 2 +- src/scripts/monitors/libcamera/name-node.lua | 2 +- src/scripts/monitors/v4l2/enumerate-device.lua | 3 ++- src/scripts/monitors/v4l2/name-device.lua | 2 +- src/scripts/monitors/v4l2/name-node.lua | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/scripts/monitors/libcamera/enumerate-device.lua b/src/scripts/monitors/libcamera/enumerate-device.lua index fe73ec46..083f3c76 100644 --- a/src/scripts/monitors/libcamera/enumerate-device.lua +++ b/src/scripts/monitors/libcamera/enumerate-device.lua @@ -16,7 +16,8 @@ config.properties = Conf.get_section ( function createCamDevice (parent, id, type, factory, properties) source = source or Plugin.find ("standard-event-source") - local e = source:call ("create-event", "create-libcam-device", parent, properties) + local e = source:call ("create-event", "create-libcam-device", parent, nil) + e:set_data ("device-properties", properties) e:set_data ("factory", factory) e:set_data ("device-sub-id", id) diff --git a/src/scripts/monitors/libcamera/name-device.lua b/src/scripts/monitors/libcamera/name-device.lua index 3f8f6165..49d4beee 100644 --- a/src/scripts/monitors/libcamera/name-device.lua +++ b/src/scripts/monitors/libcamera/name-device.lua @@ -17,8 +17,8 @@ SimpleEventHook { }, }, execute = function(event) - local properties = event:get_properties () local parent = event:get_subject () + local properties = event:get_data ("device-properties") local id = event:get_data ("device-sub-id") local name = "libcamera_device." .. diff --git a/src/scripts/monitors/libcamera/name-node.lua b/src/scripts/monitors/libcamera/name-node.lua index 1cacea6d..0e4babc9 100644 --- a/src/scripts/monitors/libcamera/name-node.lua +++ b/src/scripts/monitors/libcamera/name-node.lua @@ -16,7 +16,7 @@ SimpleEventHook { }, }, execute = function(event) - local properties = event:get_properties () + local properties = event:get_data ("node-properties") local parent = event:get_subject () local dev_props = parent.properties local factory = event:get_data ("factory") diff --git a/src/scripts/monitors/v4l2/enumerate-device.lua b/src/scripts/monitors/v4l2/enumerate-device.lua index 87d0ced8..f2668031 100644 --- a/src/scripts/monitors/v4l2/enumerate-device.lua +++ b/src/scripts/monitors/v4l2/enumerate-device.lua @@ -17,7 +17,8 @@ config.properties = Conf.get_section ( function createCamDevice (parent, id, type, factory, properties) source = source or Plugin.find ("standard-event-source") - local e = source:call ("create-event", "create-v4l2-device", parent, properties) + local e = source:call ("create-event", "create-v4l2-device", parent, nil) + e:set_data ("device-properties", properties) e:set_data ("factory", factory) e:set_data ("device-sub-id", id) diff --git a/src/scripts/monitors/v4l2/name-device.lua b/src/scripts/monitors/v4l2/name-device.lua index 7ffa5413..b59bb2fa 100644 --- a/src/scripts/monitors/v4l2/name-device.lua +++ b/src/scripts/monitors/v4l2/name-device.lua @@ -16,7 +16,7 @@ SimpleEventHook { }, }, execute = function(event) - local properties = event:get_properties () + local properties = event:get_data ("device-properties") local parent = event:get_subject () local id = event:get_data ("device-sub-id") diff --git a/src/scripts/monitors/v4l2/name-node.lua b/src/scripts/monitors/v4l2/name-node.lua index ad73e4bd..b7196bd5 100644 --- a/src/scripts/monitors/v4l2/name-node.lua +++ b/src/scripts/monitors/v4l2/name-node.lua @@ -16,7 +16,7 @@ SimpleEventHook { }, }, execute = function(event) - local properties = event:get_properties () + local properties = event:get_data ("node-properties") local parent = event:get_subject () local dev_props = parent.properties local factory = event:get_data ("factory")