[{"id":24968,"web_url":"https://patchwork.libcamera.org/comment/24968/","msgid":"<dcb819fd-beb6-b1cd-91c9-bcb9e03cecac@ideasonboard.com>","date":"2022-09-12T09:14:54","subject":"Re: [libcamera-devel] [PATCH v4 2/2] libcamera: controls:\n\tinitialise control info to ControlTypeNone by default","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Christian,\n\nThank you for the patch\n\nOn 9/4/22 3:03 AM, Christian Rauch via libcamera-devel wrote:\n> The default ControlInfo constructor allows partially initialising the\n> min/max/def values. Uninitialised values are assigned to 0 by default.\n> This implicit initialisation makes it impossible to distinguish between\n> an uninitialised and an explicitly 0-initialised ControlValue.\n>\n> Default construct the ControlValue in the ControlInfo default contructor to\n> explicitly represent uninitialised values by the ControlTypeNone type.\n>\n> Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   include/libcamera/controls.h   | 6 +++---\n>   test/controls/control_info.cpp | 4 ++--\n>   2 files changed, 5 insertions(+), 5 deletions(-)\n>\n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index ebc168fc..38d0a3e8 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -268,9 +268,9 @@ private:\n>   class ControlInfo\n>   {\n>   public:\n> -\texplicit ControlInfo(const ControlValue &min = 0,\n> -\t\t\t     const ControlValue &max = 0,\n> -\t\t\t     const ControlValue &def = 0);\n> +\texplicit ControlInfo(const ControlValue &min = {},\n> +\t\t\t     const ControlValue &max = {},\n> +\t\t\t     const ControlValue &def = {});\n>   \texplicit ControlInfo(Span<const ControlValue> values,\n>   \t\t\t     const ControlValue &def = {});\n>   \texplicit ControlInfo(std::set<bool> values, bool def);\n> diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> index 2827473b..56b4101f 100644\n> --- a/test/controls/control_info.cpp\n> +++ b/test/controls/control_info.cpp\n> @@ -26,8 +26,8 @@ protected:\n>   \t\t */\n>   \t\tControlInfo brightness;\n>\n> -\t\tif (brightness.min().get<int32_t>() != 0 ||\n> -\t\t    brightness.max().get<int32_t>() != 0) {\n> +\t\tif (brightness.min().type() != ControlType::ControlTypeNone ||\n> +\t\t    brightness.max().type() != ControlType::ControlTypeNone) {\n>   \t\t\tcout << \"Invalid control range for Brightness\" << endl;\n>   \t\t\treturn TestFail;\n>   \t\t}\n> --\n> 2.34.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D10D9C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Sep 2022 09:15:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A60DF61F8B;\n\tMon, 12 Sep 2022 11:15:01 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DFF656099F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Sep 2022 11:14:59 +0200 (CEST)","from [IPV6:2401:4900:1f3e:50f3:a89c:93ec:bcd7:8b90] (unknown\n\t[IPv6:2401:4900:1f3e:50f3:a89c:93ec:bcd7:8b90])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E91EB8A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Sep 2022 11:14:58 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662974101;\n\tbh=zADjdzk7FzLZsAuGXzReOEftIUDwXR+NAWzokAARYgM=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=UEDJ3O4aXAf86xaowegQ9OdYUz3kjk2CuymCrzmitcvYdn/7IKBOTPidOnQX4rlJL\n\tncoyOsXsmFEgXHqjnY6RyCCjjwK8mgm+soxuU18BeN9lASGEke/kb0+BBQJDIORfZU\n\tmobohPrQb1pFs1ds0fhCICQRm3wPDE+N0kN73cSkClRVsVr4p43dZ8Bf9hv2KCg6WS\n\tpNzoiXpC/JpRBHjlUXa+K1oG/9x0DY2YeWZwXgolSUUNHrRZhTGhIZ0dWThPF9eflD\n\tYQKT3nnnrY09O4KVPBpI41YI1UhmUv5+3aXOCI0MSbK7vwwJPEpbLSLkqGpKL0f4JK\n\tCd+orFmyZ/adg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662974099;\n\tbh=zADjdzk7FzLZsAuGXzReOEftIUDwXR+NAWzokAARYgM=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=aTOVV0kSfMzCTx7t7WWJes5n0ysGYETyRSIbrZTaLioUpLQDt4wMj3iPM+/rpr+7x\n\tuZFCNVpTY+wcxGiz23aCrHI8Ve3WxObBj+JbsbAftGHSDbZWG1lFFFhDRHQF9hd8Cp\n\t/z84I0JnjPigPXFtlplDzS6n+m+7ZrMXLjc2KfGk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"aTOVV0kS\"; dkim-atps=neutral","Message-ID":"<dcb819fd-beb6-b1cd-91c9-bcb9e03cecac@ideasonboard.com>","Date":"Mon, 12 Sep 2022 14:44:54 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.12.0","Content-Language":"en-US","To":"libcamera-devel@lists.libcamera.org","References":"<20220903213330.213117-1-Rauch.Christian@gmx.de>\n\t<20220903213330.213117-2-Rauch.Christian@gmx.de>","In-Reply-To":"<20220903213330.213117-2-Rauch.Christian@gmx.de>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v4 2/2] libcamera: controls:\n\tinitialise control info to ControlTypeNone by default","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]