From d522ad2549dfbd494c4f47222951522abecaea01 Mon Sep 17 00:00:00 2001 From: David Plowman Date: Mon, 7 Sep 2020 08:15:57 +0100 Subject: libcamera: Allow access to v4l2_query_ext_ctrl structure for a V4L2 control The V4L2Device::controlInfo method simply returns a pointer to the v4l2_query_ext_ctrl structure for the given control, which has already been retrieved and stored. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Kieran Bingham --- src/libcamera/v4l2_device.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 65830d41..31d4dad0 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -353,6 +353,21 @@ int V4L2Device::setControls(ControlList *ctrls) return ret; } +/** + * \brief Retrieve the v4l2_query_ext_ctrl information for the given control + * \param[in] id The V4L2 control id + * \return A pointer to the v4l2_query_ext_ctrl structure for the given + * control, or a null pointer if not found + */ +const struct v4l2_query_ext_ctrl *V4L2Device::controlInfo(uint32_t id) const +{ + const auto it = controlInfo_.find(id); + if (it == controlInfo_.end()) + return nullptr; + + return &it->second; +} + /** * \brief Retrieve the device path in sysfs * -- cgit v1.2.1