[libcamera-devel] [PATCH 08/15] v4l2: v4l2_camera: Re-validate configuration after adjusted
Paul Elder
paul.elder at ideasonboard.com
Tue Jun 16 15:12:37 CEST 2020
If the camera configuration has been adjusted, validate it again to
ensure that it's valid, before configuring the camera with it.
Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
src/v4l2/v4l2_camera.cpp | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp
index 2557320..fdbf461 100644
--- a/src/v4l2/v4l2_camera.cpp
+++ b/src/v4l2/v4l2_camera.cpp
@@ -119,11 +119,18 @@ int V4L2Camera::configure(StreamConfiguration *streamConfigOut,
LOG(V4L2Compat, Debug) << "Configuration invalid";
return -EINVAL;
}
- if (validation == CameraConfiguration::Adjusted)
+ if (validation == CameraConfiguration::Adjusted) {
LOG(V4L2Compat, Debug) << "Configuration adjusted";
+ validation = config_->validate();
+ if (validation != CameraConfiguration::Valid) {
+ LOG(V4L2Compat, Error)
+ << "Configuration adjusted but not valid";
+ return -EINVAL;
+ }
+ }
- LOG(V4L2Compat, Debug) << "Validated configuration is: "
- << streamConfig.toString();
+ LOG(V4L2Compat, Debug)
+ << "Validated configuration is: " << streamConfig.toString();
int ret = camera_->configure(config_.get());
if (ret < 0)
--
2.27.0
More information about the libcamera-devel
mailing list