[libcamera-devel] [RFC PATCH] libcamera: camera_sensor: Report mandatory control names
Kieran Bingham
kieran.bingham at ideasonboard.com
Fri Feb 5 18:03:17 CET 2021
We can not obtain the control names directly from V4L2 so create
a map of the control name, when declaring the list of mandatory
controls to enable a human readable print of any missing requirements.
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
src/libcamera/camera_sensor.cpp | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index c9e8d49b7935..9a510108f171 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -346,18 +346,23 @@ int CameraSensor::validateSensorDriver()
* For raw sensors, make sure the sensor driver supports the controls
* required by the CameraSensor class.
*/
- static constexpr uint32_t mandatoryControls[] = {
- V4L2_CID_EXPOSURE,
- V4L2_CID_HBLANK,
- V4L2_CID_PIXEL_RATE,
- V4L2_CID_VBLANK,
+ static struct {
+ uint32_t ctrl;
+ std::string name;
+ } mandatoryControls[] = {
+#define MANDATORY_CONTROL(__ctrl) { __ctrl, #__ctrl }
+ MANDATORY_CONTROL(V4L2_CID_EXPOSURE),
+ MANDATORY_CONTROL(V4L2_CID_HBLANK),
+ MANDATORY_CONTROL(V4L2_CID_PIXEL_RATE),
+ MANDATORY_CONTROL(V4L2_CID_VBLANK),
+#undef MANDATORY_CONTROL
};
err = 0;
- for (uint32_t ctrl : mandatoryControls) {
- if (!controls.count(ctrl)) {
+ for (auto &c : mandatoryControls) {
+ if (!controls.count(c.ctrl)) {
LOG(CameraSensor, Error)
- << "Mandatory V4L2 control " << utils::hex(ctrl)
+ << "Mandatory V4L2 control " << c.name
<< " not available";
err = -EINVAL;
}
--
2.25.1
More information about the libcamera-devel
mailing list