[libcamera-devel] [PATCH 2/3] libcamera: v4l2_device: Add support for integer array controls

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Dec 24 04:16:38 CET 2021


Hi David,

Thank you for the patch.

On Thu, Dec 23, 2021 at 08:01:09AM +0000, David Plowman wrote:

A commit message would be nice.

> Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
> ---
>  src/libcamera/v4l2_device.cpp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index 62c91779..6f9de8ad 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -316,6 +316,18 @@ int V4L2Device::setControls(ControlList *ctrls)
>  			break;
>  		}
>  
> +		case ControlTypeInteger32: {

Could you move this above ControlTypeInteger32 ?

> +			if (value.isArray()) {
> +				Span<uint8_t> data = value.data();
> +				v4l2Ctrl.p_u32 = reinterpret_cast<uint32_t *>(data.data());
> +				v4l2Ctrl.size = data.size();
> +			} else {
> +				v4l2Ctrl.value = value.get<int32_t>();
> +			}

This looks fine, but I think you also need to update
V4L2Device::updateControls().

> +
> +			break;
> +		}
> +
>  		default:
>  			/* \todo To be changed to support strings. */
>  			v4l2Ctrl.value = value.get<int32_t>();

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list