[libcamera-devel,05/10] test: v4l2_videodevice: controls: Use correct control range in check

Message ID 20191013232755.3292-6-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Merge V4L2ControlInfoMap and ControlInfoMap
Related show

Commit Message

Laurent Pinchart Oct. 13, 2019, 11:27 p.m. UTC
A value check on the V4L2_CID_CONTRAST control is using the brightness
control range. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/v4l2_videodevice/controls.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Niklas Söderlund Oct. 15, 2019, 12:18 a.m. UTC | #1
Hi Laurent,

Thanks for your fix.

On 2019-10-14 02:27:51 +0300, Laurent Pinchart wrote:
> A value check on the V4L2_CID_CONTRAST control is using the brightness
> control range. Fix it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

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

> ---
>  test/v4l2_videodevice/controls.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp
> index e59387ab9eba..3add6e67d2cf 100644
> --- a/test/v4l2_videodevice/controls.cpp
> +++ b/test/v4l2_videodevice/controls.cpp
> @@ -87,7 +87,7 @@ protected:
>  		}
>  
>  		if (ctrls.get(V4L2_CID_BRIGHTNESS) != brightness.range().min() ||
> -		    ctrls.get(V4L2_CID_CONTRAST) != brightness.range().max() ||
> +		    ctrls.get(V4L2_CID_CONTRAST) != contrast.range().max() ||
>  		    ctrls.get(V4L2_CID_SATURATION) != saturation.range().min().get<int32_t>() + 1) {
>  			cerr << "Controls not updated when set" << endl;
>  			return TestFail;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Jacopo Mondi Oct. 15, 2019, 3:16 p.m. UTC | #2
Hi Laurent,

On Mon, Oct 14, 2019 at 02:27:51AM +0300, Laurent Pinchart wrote:
> A value check on the V4L2_CID_CONTRAST control is using the brightness
> control range. Fix it.
>

Ouch! Thanks for fixing
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  test/v4l2_videodevice/controls.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp
> index e59387ab9eba..3add6e67d2cf 100644
> --- a/test/v4l2_videodevice/controls.cpp
> +++ b/test/v4l2_videodevice/controls.cpp
> @@ -87,7 +87,7 @@ protected:
>  		}
>
>  		if (ctrls.get(V4L2_CID_BRIGHTNESS) != brightness.range().min() ||
> -		    ctrls.get(V4L2_CID_CONTRAST) != brightness.range().max() ||
> +		    ctrls.get(V4L2_CID_CONTRAST) != contrast.range().max() ||
>  		    ctrls.get(V4L2_CID_SATURATION) != saturation.range().min().get<int32_t>() + 1) {
>  			cerr << "Controls not updated when set" << endl;
>  			return TestFail;
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp
index e59387ab9eba..3add6e67d2cf 100644
--- a/test/v4l2_videodevice/controls.cpp
+++ b/test/v4l2_videodevice/controls.cpp
@@ -87,7 +87,7 @@  protected:
 		}
 
 		if (ctrls.get(V4L2_CID_BRIGHTNESS) != brightness.range().min() ||
-		    ctrls.get(V4L2_CID_CONTRAST) != brightness.range().max() ||
+		    ctrls.get(V4L2_CID_CONTRAST) != contrast.range().max() ||
 		    ctrls.get(V4L2_CID_SATURATION) != saturation.range().min().get<int32_t>() + 1) {
 			cerr << "Controls not updated when set" << endl;
 			return TestFail;