diff options
author | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2023-12-21 11:12:33 +0100 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2023-12-29 11:33:29 +0100 |
commit | a4e6a5085b465216546b802e6bb9d55ecf278c63 (patch) | |
tree | d884cbe4c584d4f09626c3b0ba4359eefc333216 /utils | |
parent | 89289ceeb487fa305025802277222a0f21e9307e (diff) |
libcamera: Add 'required' property to controls
Add to the ControlId class a 'required' boolean flag that determine
if the control (or property) is mandatory to be supported by a Camera
in order to comply with the libcamera API specification.
Add support for a 'required' field to the controls and properties yaml
file definition and control generation scripts.
Also plumb support for the flag in the control serializer component
to allow pass the information across IPC borders.
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/gen-controls.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/gen-controls.py b/utils/gen-controls.py index 6cd5e362..1e997708 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -112,6 +112,11 @@ class Control(object): else: return f"Span<const {typ}>" + @property + def required(self): + """Is the control required""" + return self.__data.get('required') + def snake_case(s): return ''.join([c.isupper() and ('_' + c) or c for c in s]).strip('_') @@ -133,7 +138,7 @@ ${description}''') * \\var ${name} ${description} */''') - def_template = string.Template('extern const Control<${type}> ${name}(${id_name}, "${name}");') + def_template = string.Template('extern const Control<${type}> ${name}(${id_name}, "${name}", ${required});') enum_values_doc = string.Template('''/** * \\var ${name}Values * \\brief List of all $name supported values @@ -158,6 +163,7 @@ ${description} 'type': ctrl.type, 'description': format_description(ctrl.description), 'id_name': id_name, + 'required': "true" if ctrl.required else "false" } target_doc = ctrls_doc[vendor] |