[libcamera-devel,2/7] libcamera: v4l2_device: Fix getFormatSingleplane ioclt

Message ID 20190201154248.15006-3-jacopo@jmondi.org
State Superseded
Delegated to: Jacopo Mondi
Headers show
Series
  • libcamera: v4l2_device: Address comments for s/g_fmt
Related show

Commit Message

Jacopo Mondi Feb. 1, 2019, 3:42 p.m. UTC
The single plane getFormat() function wrongly used the VIDIOC_S_FMT ioctl.
Fix that by using the more opportune VIDIOC_G_FMT one.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/v4l2_device.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham Feb. 1, 2019, 9:19 p.m. UTC | #1
Hi Jacopo,

On 01/02/2019 16:42, Jacopo Mondi wrote:
> The single plane getFormat() function wrongly used the VIDIOC_S_FMT ioctl.
> Fix that by using the more opportune VIDIOC_G_FMT one.
I think this one deserves a fixes tag:

Fixes: ba8da0f2fcd0 ("libcamera: v4l2_device: Add methods to get/set
format")

With s/ioclt/ioctl/ in the commit title:

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(-)
> 
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index 26b6ff3..5ba89b9 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);
>
Laurent Pinchart Feb. 1, 2019, 10:10 p.m. UTC | #2
On Fri, Feb 01, 2019 at 10:19:33PM +0100, Kieran Bingham wrote:
> On 01/02/2019 16:42, Jacopo Mondi wrote:
> > The single plane getFormat() function wrongly used the VIDIOC_S_FMT ioctl.
> > Fix that by using the more opportune VIDIOC_G_FMT one.
> I think this one deserves a fixes tag:
> 
> Fixes: ba8da0f2fcd0 ("libcamera: v4l2_device: Add methods to get/set
> format")
> 
> With s/ioclt/ioctl/ in the commit title:

I had the exact same comments :-)

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(-)
> > 
> > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> > index 26b6ff3..5ba89b9 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);

Patch

diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 26b6ff3..5ba89b9 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);