summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2020-09-07 08:15:57 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-09-29 11:43:06 +0100
commitd522ad2549dfbd494c4f47222951522abecaea01 (patch)
treeeac8463c43730a743f5984d9cad2c5fb2dc45d33
parent15a98fab79ae71638387b3e85356550710bb643b (diff)
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 <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--include/libcamera/internal/v4l2_device.h2
-rw-r--r--src/libcamera/v4l2_device.cpp15
2 files changed, 17 insertions, 0 deletions
diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
index 3b605aab..722fb722 100644
--- a/include/libcamera/internal/v4l2_device.h
+++ b/include/libcamera/internal/v4l2_device.h
@@ -29,6 +29,8 @@ public:
ControlList getControls(const std::vector<uint32_t> &ids);
int setControls(ControlList *ctrls);
+ const struct v4l2_query_ext_ctrl *controlInfo(uint32_t id) const;
+
const std::string &deviceNode() const { return deviceNode_; }
std::string devicePath() const;
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
@@ -354,6 +354,21 @@ int V4L2Device::setControls(ControlList *ctrls)
}
/**
+ * \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
*
* This function returns the sysfs path to the physical device backing the V4L2