[libcamera-devel] [PATCH v2 11/24] libcamera: v4l2_controls: Fix control range construction for bool
Jacopo Mondi
jacopo at jmondi.org
Fri Nov 15 17:22:03 CET 2019
Hi Laurent,
On Fri, Nov 08, 2019 at 10:53:56PM +0200, Laurent Pinchart wrote:
> V4L2 controls of type V4L2_CTRL_TYPE_BOOLEAN are incorrectly described
> with a ControlRange of int32_t values. Fix it.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
indeed!
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Thanks
j
> ---
> src/libcamera/v4l2_controls.cpp | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp
> index 2462c3e2c264..b6547a7c627c 100644
> --- a/src/libcamera/v4l2_controls.cpp
> +++ b/src/libcamera/v4l2_controls.cpp
> @@ -118,12 +118,22 @@ V4L2ControlId::V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl)
> */
> V4L2ControlRange::V4L2ControlRange(const struct v4l2_query_ext_ctrl &ctrl)
> {
> - if (ctrl.type == V4L2_CTRL_TYPE_INTEGER64)
> + switch (ctrl.type) {
> + case V4L2_CTRL_TYPE_BOOLEAN:
> + ControlRange::operator=(ControlRange(static_cast<bool>(ctrl.minimum),
> + static_cast<bool>(ctrl.maximum)));
> + break;
> +
> + case V4L2_CTRL_TYPE_INTEGER64:
> ControlRange::operator=(ControlRange(static_cast<int64_t>(ctrl.minimum),
> static_cast<int64_t>(ctrl.maximum)));
> - else
> + break;
> +
> + default:
> ControlRange::operator=(ControlRange(static_cast<int32_t>(ctrl.minimum),
> static_cast<int32_t>(ctrl.maximum)));
> + break;
> + }
> }
>
> } /* namespace libcamera */
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20191115/844b78f6/attachment.sig>
More information about the libcamera-devel
mailing list