summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-11-08 13:44:20 +0000
committerNaushir Patuck <naush@raspberrypi.com>2023-11-29 09:05:38 +0000
commit0455bbbf518cc834bd72ac65e13c9ed40bf21f3c (patch)
tree97fec38bd5b40cf14e411f425fd31261b4124351 /utils
parentbba4ec63c4b0699b7f7ffb20e4f37af2b996d355 (diff)
build: controls: Rework how controls and properties are generated
Add support for using separate YAML files for controls and properties generation. The mapping of vendor/pipeline handler to control file is done through the controls_map variable in include/libcamera/meson.build. This simplifies management of vendor control definitions and avoids possible merge conflicts when changing the control_ids.yaml file for core and draft controls. With this change, libcamera and draft controls and properties files are designated the 'libcamera' vendor tag. In this change, we also rename control_ids.yaml -> control_ids_core.yaml and property_ids.yaml -> property_ids_core.yaml to designate these as core libcamera controls. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/gen-controls.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/utils/gen-controls.py b/utils/gen-controls.py
index 56e0c7ba..2a633cc0 100755
--- a/utils/gen-controls.py
+++ b/utils/gen-controls.py
@@ -12,6 +12,7 @@ import operator
import string
import sys
import yaml
+import os
class ControlEnum(object):
@@ -342,15 +343,18 @@ def main(argv):
help='Output file name. Defaults to standard output if not specified.')
parser.add_argument('--template', '-t', dest='template', type=str, required=True,
help='Template file name.')
- parser.add_argument('input', type=str,
+ parser.add_argument('input', type=str, nargs='+',
help='Input file name.')
args = parser.parse_args(argv[1:])
- data = open(args.input, 'rb').read()
- vendor = yaml.safe_load(data)['vendor']
- controls = yaml.safe_load(data)['controls']
- controls = [Control(*ctrl.popitem(), vendor) for ctrl in controls]
+ controls = []
+ for input in args.input:
+ with open(input, 'rb') as f:
+ data = f.read()
+ vendor = yaml.safe_load(data)['vendor']
+ ctrls = yaml.safe_load(data)['controls']
+ controls = controls + [Control(*ctrl.popitem(), vendor) for ctrl in ctrls]
if args.template.endswith('.cpp.in'):
data = generate_cpp(controls)