Message ID | 20230419085821.2682901-2-kieran.bingham@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
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@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;
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;
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@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. 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. include/libcamera/controls.h | 5 +++++ 1 file changed, 5 insertions(+)