[libcamera-devel] [PATCH 1/3] libcamera: controls: Support dev_t in an Integer32 type.

Kieran Bingham kieran.bingham at ideasonboard.com
Wed Apr 19 10:58:19 CEST 2023


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.

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(+)

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;
-- 
2.34.1



More information about the libcamera-devel mailing list