From patchwork Fri Mar 6 15:59:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2990 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DAB4F628D6 for ; Fri, 6 Mar 2020 17:00:22 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6AD1D312; Fri, 6 Mar 2020 17:00:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1583510422; bh=bmNaeovvXf+tItGMnvNYpiBOqQlzESZb62p5aC5BnVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oDDW5jvo8VYYBOF3HaXraLfr3dQa8BU8WbD2yoSupBTGDNnE4r/OPhlzwlvZ5JqsL 3tFsRlzd2NZSm9RZ4KBI4hd3gMHFUfjdN4JUOdJVJ7U642DNGwvgQb4LZsIQqtO+ib Zgtct4GGUGgUTpY/tNPE7yPX+FtKYr4icWc45RjU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 6 Mar 2020 17:59:48 +0200 Message-Id: <20200306160002.30549-19-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200306160002.30549-1-laurent.pinchart@ideasonboard.com> References: <20200306160002.30549-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 18/32] libcamera: controls: Add a 'size' yaml property X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Mar 2020 16:00:24 -0000 From: Jacopo Mondi Add a 'size' property to the control yaml description, to convey the size constraints of array controls. The semantics of the property contents is currently unspecified, but its presence triggers the generation of an array control (Control>). Example: - BayerGains: type: float description: Gains to apply to the four Bayer colour components for white balance size: [4] Signed-off-by: Jacopo Mondi Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/gen-controls.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libcamera/gen-controls.py b/src/libcamera/gen-controls.py index 6f020a327827..ff8bda6b16c1 100755 --- a/src/libcamera/gen-controls.py +++ b/src/libcamera/gen-controls.py @@ -42,9 +42,14 @@ ${description} name, ctrl = ctrl.popitem() id_name = snake_case(name).upper() + if ctrl.get('size'): + ctrl_type = 'Span' % ctrl['type'] + else: + ctrl_type = ctrl['type'] + info = { 'name': name, - 'type': ctrl['type'], + 'type': ctrl_type, 'description': format_description(ctrl['description']), 'id_name': id_name, } @@ -92,9 +97,14 @@ def generate_h(controls): ids.append('\t' + id_name + ' = ' + str(id_value) + ',') + if ctrl.get('size'): + ctrl_type = 'Span' % ctrl['type'] + else: + ctrl_type = ctrl['type'] + info = { 'name': name, - 'type': ctrl['type'], + 'type': ctrl_type, } enum = ctrl.get('enum')