[libcamera-devel] [PATCH v2 09/17] v4l2: v4l2_camera_proxy: Disallow dqbuf when not streaming

Paul Elder paul.elder at ideasonboard.com
Fri Jun 19 07:41:15 CEST 2020


Make VIDIOC_DQBUF return -EINVAL if the stream is not turned on.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
New in v2 (split from "v4l2: v4l2_camera: Add isRunning()")
---
 src/v4l2/v4l2_camera_proxy.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index c3032f5..63c6a2c 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -578,6 +578,9 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *cf, struct v4l2_buffer *arg)
 {
 	LOG(V4L2Compat, Debug) << "Servicing vidioc_dqbuf fd = " << cf->efd();
 
+	if (!vcam_->isRunning())
+		return -EINVAL;
+
 	int ret = lock(cf);
 	if (ret < 0)
 		return ret;
-- 
2.27.0



More information about the libcamera-devel mailing list