[libcamera-devel] [RFC PATCH 5/7] libcamera: v4l2_device: add function to get a list of volatile control ids
Matthias Fend
matthias.fend at emfend.at
Thu Feb 2 12:12:50 CET 2023
This method returns all IDs of the v4l2 controls that are marked as
volatile.
Signed-off-by: Matthias Fend <matthias.fend at emfend.at>
---
include/libcamera/internal/v4l2_device.h | 1 +
src/libcamera/v4l2_device.cpp | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
index 50d4adbc..1c1de64a 100644
--- a/include/libcamera/internal/v4l2_device.h
+++ b/include/libcamera/internal/v4l2_device.h
@@ -36,6 +36,7 @@ public:
const ControlInfoMap &controls() const { return controls_; }
+ std::vector<uint32_t> getVolatileControlIds();
ControlList getControls(const std::vector<uint32_t> &ids);
int setControls(ControlList *ctrls);
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 57a88d96..6605d36c 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -147,6 +147,21 @@ void V4L2Device::close()
fd_.reset();
}
+std::vector<uint32_t> V4L2Device::getVolatileControlIds()
+{
+ std::vector<uint32_t> ids;
+
+ for (auto &[controlId, controlInfo] : controls_) {
+ uint32_t id = controlId->id();
+ const struct v4l2_query_ext_ctrl &info = controlInfo_[id];
+
+ if (info.flags & V4L2_CTRL_FLAG_VOLATILE)
+ ids.push_back(id);
+ }
+
+ return ids;
+}
+
/**
* \fn V4L2Device::isOpen()
* \brief Check if the V4L2 device node is open
--
2.25.1
More information about the libcamera-devel
mailing list