summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/control_ids.cpp.in7
-rw-r--r--src/libcamera/controls.cpp9
-rwxr-xr-xsrc/libcamera/gen-controls.py3
3 files changed, 19 insertions, 0 deletions
diff --git a/src/libcamera/control_ids.cpp.in b/src/libcamera/control_ids.cpp.in
index dd543382..99c511d0 100644
--- a/src/libcamera/control_ids.cpp.in
+++ b/src/libcamera/control_ids.cpp.in
@@ -31,6 +31,13 @@ ${controls_doc}
${controls_def}
#endif
+/**
+ * \brief List of all supported libcamera controls
+ */
+extern const ControlIdMap controls {
+${controls_map}
+};
+
} /* namespace controls */
} /* namespace libcamera */
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index f3260edc..70c1af48 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -356,6 +356,15 @@ std::string ControlRange::toString() const
}
/**
+ * \typedef ControlIdMap
+ * \brief A map of numerical control ID to ControlId
+ *
+ * The map is used by ControlList instances to access controls by numerical
+ * IDs. A global map of all libcamera controls is provided by
+ * controls::controls.
+ */
+
+/**
* \typedef ControlInfoMap
* \brief A map of ControlId to ControlRange
*/
diff --git a/src/libcamera/gen-controls.py b/src/libcamera/gen-controls.py
index a3e52fb3..940386cc 100755
--- a/src/libcamera/gen-controls.py
+++ b/src/libcamera/gen-controls.py
@@ -25,6 +25,7 @@ ${description}
ctrls_doc = []
ctrls_def = []
+ ctrls_map = []
for ctrl in controls:
name, ctrl = ctrl.popitem()
@@ -43,10 +44,12 @@ ${description}
ctrls_doc.append(doc_template.substitute(info))
ctrls_def.append(def_template.substitute(info))
+ ctrls_map.append('\t{ ' + id_name + ', &' + name + ' },')
return {
'controls_doc': '\n\n'.join(ctrls_doc),
'controls_def': '\n'.join(ctrls_def),
+ 'controls_map': '\n'.join(ctrls_map),
}