@@ -708,7 +708,8 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)
if (ret < 0)
return ret;
- buffers_[arg->index].flags |= V4L2_BUF_FLAG_QUEUED;
+ buffers_[arg->index].flags |= V4L2_BUF_FLAG_QUEUED |
+ V4L2_BUF_FLAG_PREPARED;
arg->flags = buffers_[arg->index].flags;
@@ -835,7 +836,8 @@ int V4L2CameraProxy::vidioc_streamoff(V4L2CameraFile *file, int *arg)
int ret = vcam_->streamOff();
for (struct v4l2_buffer &buf : buffers_)
- buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE);
+ buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE |
+ V4L2_BUF_FLAG_PREPARED);
return ret;
}
@@ -997,6 +999,9 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long longRequest, void
case VIDIOC_QUERYBUF:
ret = vidioc_querybuf(file, static_cast<struct v4l2_buffer *>(arg));
break;
+ case VIDIOC_PREPARE_BUF:
+ ret = vidioc_prepare_buf(file, static_cast<struct v4l2_buffer *>(arg));
+ break;
case VIDIOC_QBUF:
ret = vidioc_qbuf(file, static_cast<struct v4l2_buffer *>(arg));
break;
Commit b5225f00cde0 added VIDIOC_PREPARE_BUF to the supported ioctls, but did not add it to the switch case. Add the missing case. Also set V4L2_BUF_FLAG_PREPARED in QBUF and clear it in STREAMOFF, as videobuf2 does, so a buffer can be prepared again after STREAMOFF. Fixes: b5225f00cde0 ("v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl") Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp> --- Tested on a Raspberry Pi 4 with a UVC webcam - preparing a buffer again after STREAMOFF failed with EINVAL in v1 and works in v3. src/v4l2/v4l2_camera_proxy.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)