[{"id":2889,"web_url":"https://patchwork.libcamera.org/comment/2889/","msgid":"<20191013161623.GT23166@bigcity.dyn.berto.se>","date":"2019-10-13T16:16:23","subject":"Re: [libcamera-devel] [PATCH v2 11/14] libcamera: v4l2_controls:\n\tRemove V4L2ControlInfo type field","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2019-10-12 21:44:04 +0300, Laurent Pinchart wrote:\n> The V4L2ControlInfo type field stores the V4L2 control type. It partly\n> duplicates the V4L2ControlInfo id().type() that stores the corresponding\n> libcamera control type. The two fields are not strictly identical, but\n> having two types doesn't provide us with any extra value. As this is\n> confusing, remove the V4L2ControlInfo type field.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/include/v4l2_controls.h | 2 --\n>  src/libcamera/v4l2_controls.cpp       | 7 -------\n>  src/libcamera/v4l2_device.cpp         | 8 ++++----\n>  3 files changed, 4 insertions(+), 13 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h\n> index 71ce377fe4c5..949ca21cb863 100644\n> --- a/src/libcamera/include/v4l2_controls.h\n> +++ b/src/libcamera/include/v4l2_controls.h\n> @@ -32,14 +32,12 @@ public:\n>  \tV4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl);\n>  \n>  \tconst ControlId &id() const { return id_; }\n> -\tunsigned int type() const { return type_; }\n>  \tsize_t size() const { return size_; }\n>  \n>  \tconst ControlRange &range() const { return range_; }\n>  \n>  private:\n>  \tV4L2ControlId id_;\n> -\tunsigned int type_;\n>  \tsize_t size_;\n>  \n>  \tControlRange range_;\n> diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp\n> index a630a2583d33..3f5f3ff10880 100644\n> --- a/src/libcamera/v4l2_controls.cpp\n> +++ b/src/libcamera/v4l2_controls.cpp\n> @@ -127,7 +127,6 @@ V4L2ControlId::V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl)\n>  V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)\n>  \t: id_(ctrl)\n>  {\n> -\ttype_ = ctrl.type;\n>  \tsize_ = ctrl.elem_size * ctrl.elems;\n>  \n>  \tif (ctrl.type == V4L2_CTRL_TYPE_INTEGER64)\n> @@ -144,12 +143,6 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)\n>   * \\return The V4L2 control ID\n>   */\n>  \n> -/**\n> - * \\fn V4L2ControlInfo::type()\n> - * \\brief Retrieve the control type as defined by V4L2_CTRL_TYPE_*\n> - * \\return The V4L2 control type\n> - */\n> -\n>  /**\n>   * \\fn V4L2ControlInfo::size()\n>   * \\brief Retrieve the control value data size (in bytes)\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 466c3d41f6e3..8c5998435020 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -262,8 +262,8 @@ int V4L2Device::setControls(V4L2ControlList *ctrls)\n>  \t\tv4l2Ctrls[i].id = ctrl->id();\n>  \n>  \t\t/* Set the v4l2_ext_control value for the write operation. */\n> -\t\tswitch (info->type()) {\n> -\t\tcase V4L2_CTRL_TYPE_INTEGER64:\n> +\t\tswitch (info->id().type()) {\n> +\t\tcase ControlTypeInteger64:\n>  \t\t\tv4l2Ctrls[i].value64 = ctrl->value().get<int64_t>();\n>  \t\t\tbreak;\n>  \t\tdefault:\n> @@ -392,8 +392,8 @@ void V4L2Device::updateControls(V4L2ControlList *ctrls,\n>  \t\tconst V4L2ControlInfo *info = controlInfo[i];\n>  \t\tV4L2Control *ctrl = ctrls->getByIndex(i);\n>  \n> -\t\tswitch (info->type()) {\n> -\t\tcase V4L2_CTRL_TYPE_INTEGER64:\n> +\t\tswitch (info->id().type()) {\n> +\t\tcase ControlTypeInteger64:\n>  \t\t\tctrl->value().set<int64_t>(v4l2Ctrl->value64);\n>  \t\t\tbreak;\n>  \t\tdefault:\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9B2DA61562\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 13 Oct 2019 18:16:25 +0200 (CEST)","by mail-lj1-x244.google.com with SMTP id f5so14243271ljg.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 13 Oct 2019 09:16:25 -0700 (PDT)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\tq66sm3422174ljq.101.2019.10.13.09.16.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 13 Oct 2019 09:16:24 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=0SK4tXb/oZjJpQ2qn2yICVXmGWS2D8thlQxOYKZgscI=;\n\tb=DLUHTnu71qxhYTbldo1BI4QZGhxcFHuC7j9VLjFCrTHcqWtSRzILlc5qgYN3roCE3C\n\tKGTHFFf7uNFM++4eim86EquAFXaXq0aPThlJfWP9OmyU8P8Xn3GTEMXOL187TpJ0hfD8\n\tpCJ547l8doKbr9qSS1B9xwKSNmD1PMUw9SRG8K6rnRxmveHDoNEORsqR1QlyjHCXxgxF\n\tQIUHq93P8AbvLDaBK6os4B5jv7V3BSlJmqWqzLdCGtJjYvk5RDj8Hsyhs2mmmucryMQU\n\txXO3CVMEl5d3+Pm1MTQdYQM+RuC8adEuh5oMa5iHdOxZs1Fna7HnePA3V4wtJPF9BgWh\n\tISaw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=0SK4tXb/oZjJpQ2qn2yICVXmGWS2D8thlQxOYKZgscI=;\n\tb=hFUZ9hae95Ue4PvEB4JOqXvYzpvFRdqgeYWkWum/VhboN/Heledwp1zCVj64PsRH6c\n\ta+rHbV/1vDW02/JequzudmuXF2LE8IfvT60QG9pyufetGwRsO26yr06Ur1g7VkOzm4AZ\n\tTJSrw5vJsI73CKZWSluFr8mJwBBJ2HKnwOomcF47ElXaH1PVGMgkSav4PGZ701yys/FS\n\tPTEpUazyEZOjMfBPqTuY/p8G0b6fbXKJ9O5eyJyPh4lKGsOjpxgllCQYBUlRtebMme01\n\tUBzF0f3p9MNqy29aODmHIvKWHX2CAbPBR7U48szAeqjRkbKRtkah4sAv/2lWd81lamxn\n\tfqDA==","X-Gm-Message-State":"APjAAAXl0mwMZaWy/H8dGCqdxQYO4UQ8CWSlE1b1gqqmjRWbo/I9TrUr\n\tm7RuDPLodPJO0kzcDDH6OjsGcH5LNzM=","X-Google-Smtp-Source":"APXvYqx0AQRMy2CTiGa9/TVCQBGayBNImRmxL60jKQexcxU2l8rvULsOxBaO7nqoM+cNFXF9B4FKhQ==","X-Received":"by 2002:a2e:9702:: with SMTP id\n\tr2mr14197591lji.194.1570983385032; \n\tSun, 13 Oct 2019 09:16:25 -0700 (PDT)","Date":"Sun, 13 Oct 2019 18:16:23 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191013161623.GT23166@bigcity.dyn.berto.se>","References":"<20191012184407.31684-1-laurent.pinchart@ideasonboard.com>\n\t<20191012184407.31684-12-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20191012184407.31684-12-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 11/14] libcamera: v4l2_controls:\n\tRemove V4L2ControlInfo type field","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>","X-List-Received-Date":"Sun, 13 Oct 2019 16:16:25 -0000"}}]