[libcamera-devel] libcamera: v4l2_device: Fix error messages in setControls()

Message ID 20190829080919.16396-1-niklas.soderlund@ragnatech.se
State Accepted
Commit 808a7fc04efb502494b0c8dc81dd143c0b652fc2
Headers show
Series
  • [libcamera-devel] libcamera: v4l2_device: Fix error messages in setControls()
Related show

Commit Message

Niklas Söderlund Aug. 29, 2019, 8:09 a.m. UTC
The error messages looks copied from getControls() without being updated
for the set controls case, fix this.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/libcamera/v4l2_device.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jacopo Mondi Aug. 29, 2019, 9:08 a.m. UTC | #1
Hi Niklas,
   ups, thanks for fixing this

On Thu, Aug 29, 2019 at 10:09:19AM +0200, Niklas Söderlund wrote:
> The error messages looks copied from getControls() without being updated
> for the set controls case, fix this.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

Acked-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j
> ---
>  src/libcamera/v4l2_device.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index f89546610ac69ba0..349bf2d2970418e4 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -287,13 +287,13 @@ int V4L2Device::setControls(V4L2ControlList *ctrls)
>
>  		/* Generic validation error. */
>  		if (errorIdx == 0 || errorIdx >= count) {
> -			LOG(V4L2, Error) << "Unable to read controls: "
> +			LOG(V4L2, Error) << "Unable to set controls: "
>  					 << strerror(ret);
>  			return -EINVAL;
>  		}
>
>  		/* A specific control failed. */
> -		LOG(V4L2, Error) << "Unable to read control " << errorIdx
> +		LOG(V4L2, Error) << "Unable to set control " << errorIdx
>  				 << ": " << strerror(ret);
>  		count = errorIdx - 1;
>  		ret = errorIdx;
> --
> 2.22.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Kieran Bingham Aug. 29, 2019, 9:48 a.m. UTC | #2
Hi Niklas,

On 29/08/2019 09:09, Niklas Söderlund wrote:
> The error messages looks copied from getControls() without being updated
> for the set controls case, fix this.

Indeed, I'd even say they /are/ copied :-D

> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

Thanks for the fix.

Perhaps a:

Fixes: eb068f4e67ee ("libcamera: v4l2_device: Implement get and set
controls")

but that's not essential.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


> ---
>  src/libcamera/v4l2_device.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index f89546610ac69ba0..349bf2d2970418e4 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -287,13 +287,13 @@ int V4L2Device::setControls(V4L2ControlList *ctrls)
>  
>  		/* Generic validation error. */
>  		if (errorIdx == 0 || errorIdx >= count) {
> -			LOG(V4L2, Error) << "Unable to read controls: "
> +			LOG(V4L2, Error) << "Unable to set controls: "
>  					 << strerror(ret);
>  			return -EINVAL;
>  		}
>  
>  		/* A specific control failed. */
> -		LOG(V4L2, Error) << "Unable to read control " << errorIdx
> +		LOG(V4L2, Error) << "Unable to set control " << errorIdx
>  				 << ": " << strerror(ret);
>  		count = errorIdx - 1;
>  		ret = errorIdx;
>
Niklas Söderlund Aug. 29, 2019, 3:19 p.m. UTC | #3
Hi,

I have now pushed this patch with Jacopo's and Kieran's tags.

On 2019-08-29 10:09:19 +0200, Niklas Söderlund wrote:
> The error messages looks copied from getControls() without being updated
> for the set controls case, fix this.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
>  src/libcamera/v4l2_device.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index f89546610ac69ba0..349bf2d2970418e4 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -287,13 +287,13 @@ int V4L2Device::setControls(V4L2ControlList *ctrls)
>  
>  		/* Generic validation error. */
>  		if (errorIdx == 0 || errorIdx >= count) {
> -			LOG(V4L2, Error) << "Unable to read controls: "
> +			LOG(V4L2, Error) << "Unable to set controls: "
>  					 << strerror(ret);
>  			return -EINVAL;
>  		}
>  
>  		/* A specific control failed. */
> -		LOG(V4L2, Error) << "Unable to read control " << errorIdx
> +		LOG(V4L2, Error) << "Unable to set control " << errorIdx
>  				 << ": " << strerror(ret);
>  		count = errorIdx - 1;
>  		ret = errorIdx;
> -- 
> 2.22.1
>

Patch

diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index f89546610ac69ba0..349bf2d2970418e4 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -287,13 +287,13 @@  int V4L2Device::setControls(V4L2ControlList *ctrls)
 
 		/* Generic validation error. */
 		if (errorIdx == 0 || errorIdx >= count) {
-			LOG(V4L2, Error) << "Unable to read controls: "
+			LOG(V4L2, Error) << "Unable to set controls: "
 					 << strerror(ret);
 			return -EINVAL;
 		}
 
 		/* A specific control failed. */
-		LOG(V4L2, Error) << "Unable to read control " << errorIdx
+		LOG(V4L2, Error) << "Unable to set control " << errorIdx
 				 << ": " << strerror(ret);
 		count = errorIdx - 1;
 		ret = errorIdx;