From 2f516306a7b72f3f13c1648161e79ba8778351ae Mon Sep 17 00:00:00 2001
From: Jacopo Mondi <jacopo@jmondi.org>
Date: Thu, 31 Jan 2019 17:28:04 +0100
Subject: libcamera: v4l2_device: Fix getFormatSingleplane ioctl

The single plane getFormat() function wrongly used the VIDIOC_S_FMT ioctl.
Fix that by using the more opportune VIDIOC_G_FMT one.

Fixes: ba8da0f2fcd0 ("libcamera: v4l2_device: Add methods to get/set format")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/v4l2_device.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 26b6ff36..5ba89b90 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -305,7 +305,7 @@ int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *fmt)
 	int ret;
 
 	v4l2Fmt.type = bufferType_;
-	ret = ioctl(fd_, VIDIOC_S_FMT, &v4l2Fmt);
+	ret = ioctl(fd_, VIDIOC_G_FMT, &v4l2Fmt);
 	if (ret) {
 		ret = -errno;
 		LOG(Error) << "Unable to get format: " << strerror(-ret);
-- 
cgit v1.2.1