[libcamera-devel] [PATCH 1/3] libcamera: controls: Support dev_t in an Integer32 type.
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Thu Apr 20 04:55:18 CEST 2023
Hi Kieran,
Thank you for the patch.
On Wed, Apr 19, 2023 at 09:58:19AM +0100, Kieran Bingham via libcamera-devel wrote:
> Allow dev_t device numbers to be stored in a ControlValue utilising the
> space of a 32 bit integer.
>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>
> Note that dev_t is typedef'd as an unsigned long, and this allows all
> unsigned long types to be mapped to a ControlTypeInteger32.
"unsigned long" is a 64-bit value on 64-bit platforms.
> I'm not sure I like that bit, so I'm very open to ideas and suggestions
> here. Ideally without having to duplicate the devnum vector just after
> it's created, just to retype it.
How about using ControlTypeInteger64 and converting the devnums vector
to a vector or int64_t internally ?
> include/libcamera/controls.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index cf94205577a5..84033babbcd5 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -62,6 +62,11 @@ struct control_type<int32_t> {
> static constexpr ControlType value = ControlTypeInteger32;
> };
>
> +template<>
> +struct control_type<dev_t> {
> + static constexpr ControlType value = ControlTypeInteger32;
> +};
> +
> template<>
> struct control_type<int64_t> {
> static constexpr ControlType value = ControlTypeInteger64;
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list