From patchwork Fri Sep 30 12:18:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17472 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 80385C0DA4 for ; Fri, 30 Sep 2022 12:18:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D426F623A8; Fri, 30 Sep 2022 14:18:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664540306; bh=uS4CM4/ULJ4TJV3FvdUNx37VadLNLhTLqdC7+m43g98=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=xjjTiDH5OWbBuDXiS04WWMl9u2hrDCYl2RPn8uk8iXcMqPxoy4GRIsZabyxf5IYRP iYehuqcoAX59ERKIJZfT7JKjErAbhMmv8R4DWDx3toeoAadWlxxiXTPJnKCyZeWcPe 1ew8yH2JtvY9bE0fWhkFJ3EcTkooxtCSpy3gWYXJKLI2gtVOW3LhgspEiErHomdh9I Z2UxMOCrDFzx3N/xI1sAlbic06s1FHU/shhG4AjVRjaZMLkoqrSL1wISKs3gf/Dg8s Gcb0ldqvCeZIlIcevZ6UEs1juPvRqH5KIJagRSjerO5WgIzDMiCeJzWVjoNUelMt9N tanuocl59qDKg== Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2791761F77 for ; Fri, 30 Sep 2022 14:18:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="jgVcfckS"; dkim-atps=neutral Received: by mail-wr1-x42e.google.com with SMTP id c11so6562276wrp.11 for ; Fri, 30 Sep 2022 05:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=3ru394CvH5Isp/Tf9pxxdeTNiaVNY3DnZ6h1t0zkWXA=; b=jgVcfckSd1npJOsRrQI+htBwWexXPdvxM1mmIYcLrT5DvoZPM5pKRV37z3NnjsJEID 2wySjt4vV+96xJsKPl26/F0Ute/Ahgmk2vKUJBYHxOGfQqQz0rt3auz18dsp+NgWxASZ LklOHdLrrmxtDYF3oTxNfkaAUqBYeAfyM481dCWlSggyWex7f7McY4oozHqNzyUY0e0g G9T8RVnD0cr0mW0FRnY7ZH8n/19j8UGxXiJ4fNxEQTrscWjglewvHMiSxSMJH1GwoH1j D9sDJKNp6Qznbb/wOgH/OcXafwCdaj7XuURwrn7DQSA6fDLfvfmD6PRBvNgerIQ0+fZU WtvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=3ru394CvH5Isp/Tf9pxxdeTNiaVNY3DnZ6h1t0zkWXA=; b=CinXBBVDAYdQm1xvJ3oDlubuBueZuqgSdlmAmff/FMIcTQdMOPCZRa1mQUcIyhm8hb wtQc2HA4fgo1OtZUlM5No1ZGhRbhHHXSt6/B7PHCUtsTPU2U59qERuH/54Tuat/gpaU/ Uo3cqpU3BVKPlp2WXi2grYO3YkYyc1tTmuKl2rAM4+sUSuDZGap+K9orChOADgPpGvv1 qp2ilV53Li2lfny400JEtvM0xJPzmCnHJysofEUASlVSdcIIfrGvj0YZL/kq+9uYSbzK 7HOTsajyUOrZQ9Es5FhUug4SMvWiaxCLLEf9uQRHJf6b8Vcw380/F0Q3azl/LhxTQeTM 0Iaw== X-Gm-Message-State: ACrzQf3LQ2kjWrnY75bgqr1RXcUhWpL1MH+nyNoltDJtY/B6K8tXycvz jFgC69eCB/MnSMxs9AjMZEvLIT3DqiJ2qQ== X-Google-Smtp-Source: AMsMyM6oRXXRM0k41x0jdgOvM2lceo5Mu3xaxlYkhpF0RUYoj0kUfoXVm2wOHwKgrbP6K7wfe/YobA== X-Received: by 2002:a5d:6245:0:b0:225:3e24:e5b1 with SMTP id m5-20020a5d6245000000b002253e24e5b1mr5753630wrv.698.1664540304225; Fri, 30 Sep 2022 05:18:24 -0700 (PDT) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id u5-20020a7bcb05000000b003a3170a7af9sm1978208wmj.4.2022.09.30.05.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 05:18:23 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 30 Sep 2022 13:18:12 +0100 Message-Id: <20220930121812.5768-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] py: Support controls that are ControlTypeNone 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-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Such controls can now be created when a control doesn't have a reasonable or obvious default value. We support them using Python's "None" value, rather than generating a runtime error. Signed-off-by: David Plowman Reviewed-by: Kieran Bingham Reviewed-by: Christian Rauch Reviewed-by: Tomi Valkeinen --- src/py/libcamera/py_helpers.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/py/libcamera/py_helpers.cpp b/src/py/libcamera/py_helpers.cpp index 45aecce9..f685e606 100644 --- a/src/py/libcamera/py_helpers.cpp +++ b/src/py/libcamera/py_helpers.cpp @@ -55,6 +55,7 @@ py::object controlValueToPy(const ControlValue &cv) return py::cast(v); } case ControlTypeNone: + return py::none(); default: throw std::runtime_error("Unsupported ControlValue type"); } @@ -91,6 +92,7 @@ ControlValue pyToControlValue(const py::object &ob, ControlType type) case ControlTypeSize: return ControlValue(ob.cast()); case ControlTypeNone: + return ControlValue(); default: throw std::runtime_error("Control type not implemented"); }