[{"id":21876,"web_url":"https://patchwork.libcamera.org/comment/21876/","msgid":"<YcU7lkGSq2HRcsLp@pendragon.ideasonboard.com>","date":"2021-12-24T03:16:38","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_device: Add\n\tsupport for integer array controls","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nThank you for the patch.\n\nOn Thu, Dec 23, 2021 at 08:01:09AM +0000, David Plowman wrote:\n\nA commit message would be nice.\n\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  src/libcamera/v4l2_device.cpp | 12 ++++++++++++\n>  1 file changed, 12 insertions(+)\n> \n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 62c91779..6f9de8ad 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -316,6 +316,18 @@ int V4L2Device::setControls(ControlList *ctrls)\n>  \t\t\tbreak;\n>  \t\t}\n>  \n> +\t\tcase ControlTypeInteger32: {\n\nCould you move this above ControlTypeInteger32 ?\n\n> +\t\t\tif (value.isArray()) {\n> +\t\t\t\tSpan<uint8_t> data = value.data();\n> +\t\t\t\tv4l2Ctrl.p_u32 = reinterpret_cast<uint32_t *>(data.data());\n> +\t\t\t\tv4l2Ctrl.size = data.size();\n> +\t\t\t} else {\n> +\t\t\t\tv4l2Ctrl.value = value.get<int32_t>();\n> +\t\t\t}\n\nThis looks fine, but I think you also need to update\nV4L2Device::updateControls().\n\n> +\n> +\t\t\tbreak;\n> +\t\t}\n> +\n>  \t\tdefault:\n>  \t\t\t/* \\todo To be changed to support strings. */\n>  \t\t\tv4l2Ctrl.value = value.get<int32_t>();","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 14573BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Dec 2021 03:16:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2F57260909;\n\tFri, 24 Dec 2021 04:16:46 +0100 (CET)","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 0D64B608E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Dec 2021 04:16:44 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 71E5671;\n\tFri, 24 Dec 2021 04:16:43 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZAjWMtsa\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640315803;\n\tbh=Qk4ieX/aqruCqa2YbiewQHDsKMfx6cSmSmRWtlIkKVs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ZAjWMtsaAZJQfQFHb9rGm0PJCVomYN5ZXgE66R9VPpKHJkCzF3n0mj065ceWqPqBz\n\tsW7W5Tco865zBnCexbn5xUaHBD49e1At9aRqrW4iddCq6ni6k2X1U/0H9M77xhi1DE\n\tI8fZztq8kKR1Pk3Iakjic/lh/6O5Kp5OOdFnOGu0=","Date":"Fri, 24 Dec 2021 05:16:38 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<YcU7lkGSq2HRcsLp@pendragon.ideasonboard.com>","References":"<20211223080110.9766-1-david.plowman@raspberrypi.com>\n\t<20211223080110.9766-3-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211223080110.9766-3-david.plowman@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_device: Add\n\tsupport for integer array controls","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21910,"web_url":"https://patchwork.libcamera.org/comment/21910/","msgid":"<CAHW6GYJwc=xXvofBFiseP7H_wKHDp4tqrccuPppQpcjKzEf1Eg@mail.gmail.com>","date":"2021-12-30T09:28:40","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_device: Add\n\tsupport for integer array controls","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Laurent\n\nThanks for the review!\n\nOn Fri, 24 Dec 2021 at 03:16, Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi David,\n>\n> Thank you for the patch.\n>\n> On Thu, Dec 23, 2021 at 08:01:09AM +0000, David Plowman wrote:\n>\n> A commit message would be nice.\n>\n> > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > ---\n> >  src/libcamera/v4l2_device.cpp | 12 ++++++++++++\n> >  1 file changed, 12 insertions(+)\n> >\n> > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > index 62c91779..6f9de8ad 100644\n> > --- a/src/libcamera/v4l2_device.cpp\n> > +++ b/src/libcamera/v4l2_device.cpp\n> > @@ -316,6 +316,18 @@ int V4L2Device::setControls(ControlList *ctrls)\n> >                       break;\n> >               }\n> >\n> > +             case ControlTypeInteger32: {\n>\n> Could you move this above ControlTypeInteger32 ?\n\nI'm guessing you mean this should go between ControlTypeInteger64 and\nControlTypeIntegerByte, like I see in updateControls()? Will do!\n\n>\n> > +                     if (value.isArray()) {\n> > +                             Span<uint8_t> data = value.data();\n> > +                             v4l2Ctrl.p_u32 = reinterpret_cast<uint32_t *>(data.data());\n> > +                             v4l2Ctrl.size = data.size();\n> > +                     } else {\n> > +                             v4l2Ctrl.value = value.get<int32_t>();\n> > +                     }\n>\n> This looks fine, but I think you also need to update\n> V4L2Device::updateControls().\n\nJust to check (my understanding of how ControlLists work has always\nbeen a bit hazy...), the same logic will apply there as in the \"Byte\"\ncase, i.e. I just need to check for the array type and then do\nnothing?\n\nThanks!\nDavid\n\n>\n> > +\n> > +                     break;\n> > +             }\n> > +\n> >               default:\n> >                       /* \\todo To be changed to support strings. */\n> >                       v4l2Ctrl.value = value.get<int32_t>();\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 163ECBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Dec 2021 09:28:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 326BC60915;\n\tThu, 30 Dec 2021 10:28:54 +0100 (CET)","from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n\t[IPv6:2a00:1450:4864:20::32a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 77F85604F6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Dec 2021 10:28:52 +0100 (CET)","by mail-wm1-x32a.google.com with SMTP id c66so15215776wma.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Dec 2021 01:28:52 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"YvFkH7lL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=Pt2ZTuCrRyEvXZSepyxMbMsGGM8gKYXhH6qTXOF/YwQ=;\n\tb=YvFkH7lL3XRkp8iLm/ckm0PSSt61yI08ZL8up7sF/+o0iQWJXy3NmcLvoPEUN+FH1O\n\tCTSRoFI/7GdARccf9Z9lxUpTE86vQN8tiXFcZn9QAr5tPCdzL4yzPlPTJ6qYEhLCB61l\n\ttFD7oocKUM1Jqoo/wTNK9QrMXFU7QBkndiOvb5uGpgg44GkWlwyMJkc2TN+yedsJANJa\n\t0E6elKYv7tLfWcIANrRiC+vxr2desUKredzizSvnRvGYP/HA7lZnuoGGvrq+4lqPtqtT\n\tBWoISTnwQu2afipzFxBq7xNO7hcsQTnr89OJzWFf/Nb8JPxoVoGv8/qovr0RPISWU/zx\n\tFIWw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=Pt2ZTuCrRyEvXZSepyxMbMsGGM8gKYXhH6qTXOF/YwQ=;\n\tb=B7d3ow1YbT0KuP6fwprr5V8H1qZ1EADZ8hc+qdbDyc+dJQNy6uDo1Uja7blPudx/Mz\n\tQU6lf/AsatIU/4NogdFiQMOjUPRr5nE5qZYzxhNh+02EjZiNSkjnN7cXhbWGqtnUjTTZ\n\t1+vZfsQO5fypv75fAuKKzB0kGlLAAPNf+MSzCrp4CREeCOT1bvj3dpF9cpxwA4a7s4bQ\n\tVBO1VSEzlpz7J9bOupyudFlRlRxKhD4HuNBGWiS04L8cSR0VG1epLZoODRNYNljBoM+f\n\tmqdyWyFDZGU81zLsTYAwAk3iYyfULpXxI3kyp7eVsxmpSf7Gf9KPJbP5gM5XL9lRadvz\n\t3lxw==","X-Gm-Message-State":"AOAM531NzziF93MMVWFfwHjmjsJNIjJvQHvXw9tqNLE0IvicOBFr5iSX\n\tWuZU1omg2xC/BRNb84zpRBUIFjq7FJKJ8gHgE/oT8w==","X-Google-Smtp-Source":"ABdhPJyJ5E2QwHjwYq8EBbaHKioPg6RtxS1H4AahKvIlPzgfRa6ytCsArjT5+nYCr7dv9rOF1x1nkCJ/+C+sqmBay24=","X-Received":"by 2002:a05:600c:40d6:: with SMTP id\n\tm22mr25121570wmh.163.1640856532052; \n\tThu, 30 Dec 2021 01:28:52 -0800 (PST)","MIME-Version":"1.0","References":"<20211223080110.9766-1-david.plowman@raspberrypi.com>\n\t<20211223080110.9766-3-david.plowman@raspberrypi.com>\n\t<YcU7lkGSq2HRcsLp@pendragon.ideasonboard.com>","In-Reply-To":"<YcU7lkGSq2HRcsLp@pendragon.ideasonboard.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Thu, 30 Dec 2021 09:28:40 +0000","Message-ID":"<CAHW6GYJwc=xXvofBFiseP7H_wKHDp4tqrccuPppQpcjKzEf1Eg@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_device: Add\n\tsupport for integer array controls","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21914,"web_url":"https://patchwork.libcamera.org/comment/21914/","msgid":"<Yc3cx7pK2JXhWL6x@pendragon.ideasonboard.com>","date":"2021-12-30T16:22:31","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_device: Add\n\tsupport for integer array controls","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nOn Thu, Dec 30, 2021 at 09:28:40AM +0000, David Plowman wrote:\n> On Fri, 24 Dec 2021 at 03:16, Laurent Pinchart wrote:\n> > On Thu, Dec 23, 2021 at 08:01:09AM +0000, David Plowman wrote:\n> >\n> > A commit message would be nice.\n> >\n> > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > > ---\n> > >  src/libcamera/v4l2_device.cpp | 12 ++++++++++++\n> > >  1 file changed, 12 insertions(+)\n> > >\n> > > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > > index 62c91779..6f9de8ad 100644\n> > > --- a/src/libcamera/v4l2_device.cpp\n> > > +++ b/src/libcamera/v4l2_device.cpp\n> > > @@ -316,6 +316,18 @@ int V4L2Device::setControls(ControlList *ctrls)\n> > >                       break;\n> > >               }\n> > >\n> > > +             case ControlTypeInteger32: {\n> >\n> > Could you move this above ControlTypeInteger32 ?\n> \n> I'm guessing you mean this should go between ControlTypeInteger64 and\n> ControlTypeIntegerByte, like I see in updateControls()? Will do!\n\nI would actually put 32 before 64 (so just before ControlTypeInteger64).\nThat doesn't match V4L2Device::updateControls(), but as you'll have to\nupdate that function anyway, you can also fix the order there :-)\n\n> >\n> > > +                     if (value.isArray()) {\n> > > +                             Span<uint8_t> data = value.data();\n> > > +                             v4l2Ctrl.p_u32 = reinterpret_cast<uint32_t *>(data.data());\n> > > +                             v4l2Ctrl.size = data.size();\n> > > +                     } else {\n> > > +                             v4l2Ctrl.value = value.get<int32_t>();\n> > > +                     }\n> >\n> > This looks fine, but I think you also need to update\n> > V4L2Device::updateControls().\n> \n> Just to check (my understanding of how ControlLists work has always\n> been a bit hazy...), the same logic will apply there as in the \"Byte\"\n> case, i.e. I just need to check for the array type and then do\n> nothing?\n\nThat's correct. Actually, maybe the following would be more generic ?\n\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 1e26305742db..be66b8eb523a 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -671,6 +671,14 @@ void V4L2Device::updateControls(ControlList *ctrls,\n \t\tconst unsigned int id = v4l2Ctrl.id;\n\n \t\tControlValue value = ctrls->get(id);\n+\t\tif (value.isArray()) {\n+\t\t\t/*\n+\t\t\t * No action required, the VIDIOC_[GS]_EXT_CTRLS ioctl\n+\t\t\t * accessed the ControlValue storage directly for array\n+\t\t\t * controls.\n+\t\t\t */\n+\t\t\tcontinue;\n+\t\t}\n\n \t\tconst auto iter = controls_.find(id);\n \t\tASSERT(iter != controls_.end());\n@@ -684,13 +692,6 @@ void V4L2Device::updateControls(ControlList *ctrls,\n \t\t\tvalue.set<int32_t>(v4l2Ctrl.value);\n \t\t\tbreak;\n\n-\t\tcase ControlTypeByte:\n-\t\t\t/*\n-\t\t\t * No action required, the VIDIOC_[GS]_EXT_CTRLS ioctl\n-\t\t\t * accessed the ControlValue storage directly.\n-\t\t\t */\n-\t\t\tbreak;\n-\n \t\tdefault:\n \t\t\t/*\n \t\t\t * \\todo To be changed when support for string controls\n\n\nI haven't tested it, maybe I'm missing something.\n\n> > > +\n> > > +                     break;\n> > > +             }\n> > > +\n> > >               default:\n> > >                       /* \\todo To be changed to support strings. */\n> > >                       v4l2Ctrl.value = value.get<int32_t>();","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 BC545BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Dec 2021 16:22:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 140EA608EB;\n\tThu, 30 Dec 2021 17:22:35 +0100 (CET)","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 785F160115\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Dec 2021 17:22:33 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E7D192A5;\n\tThu, 30 Dec 2021 17:22:32 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UNglmfET\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640881353;\n\tbh=P1qWHTHU8BuYM1kEExnFX+afQp31qKTR2EI3u0fReeA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UNglmfETw7IQBj3wO6fqFCCjAoz1orDvd3Fz08MKp/u/uVBrJGHsUj3tB7nUqOWkg\n\tbpQpT0sVKyqVbQpM3PsbSqYJi7rYSS2u02DZwch4sUVLtIvpPJ7LVI7Sqn0kGRBaTs\n\tW0g1d7IbxSvmENwhkjLWxf8qLmGpFM1MeLchucQ4=","Date":"Thu, 30 Dec 2021 18:22:31 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<Yc3cx7pK2JXhWL6x@pendragon.ideasonboard.com>","References":"<20211223080110.9766-1-david.plowman@raspberrypi.com>\n\t<20211223080110.9766-3-david.plowman@raspberrypi.com>\n\t<YcU7lkGSq2HRcsLp@pendragon.ideasonboard.com>\n\t<CAHW6GYJwc=xXvofBFiseP7H_wKHDp4tqrccuPppQpcjKzEf1Eg@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAHW6GYJwc=xXvofBFiseP7H_wKHDp4tqrccuPppQpcjKzEf1Eg@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_device: Add\n\tsupport for integer array controls","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21915,"web_url":"https://patchwork.libcamera.org/comment/21915/","msgid":"<Yc3epJt5F0jzAyxp@pendragon.ideasonboard.com>","date":"2021-12-30T16:30:28","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_device: Add\n\tsupport for integer array controls","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nOn Thu, Dec 30, 2021 at 06:22:33PM +0200, Laurent Pinchart wrote:\n> On Thu, Dec 30, 2021 at 09:28:40AM +0000, David Plowman wrote:\n> > On Fri, 24 Dec 2021 at 03:16, Laurent Pinchart wrote:\n> > > On Thu, Dec 23, 2021 at 08:01:09AM +0000, David Plowman wrote:\n> > >\n> > > A commit message would be nice.\n> > >\n> > > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> > > > ---\n> > > >  src/libcamera/v4l2_device.cpp | 12 ++++++++++++\n> > > >  1 file changed, 12 insertions(+)\n> > > >\n> > > > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > > > index 62c91779..6f9de8ad 100644\n> > > > --- a/src/libcamera/v4l2_device.cpp\n> > > > +++ b/src/libcamera/v4l2_device.cpp\n> > > > @@ -316,6 +316,18 @@ int V4L2Device::setControls(ControlList *ctrls)\n> > > >                       break;\n> > > >               }\n> > > >\n> > > > +             case ControlTypeInteger32: {\n> > >\n> > > Could you move this above ControlTypeInteger32 ?\n> > \n> > I'm guessing you mean this should go between ControlTypeInteger64 and\n> > ControlTypeIntegerByte, like I see in updateControls()? Will do!\n> \n> I would actually put 32 before 64 (so just before ControlTypeInteger64).\n> That doesn't match V4L2Device::updateControls(), but as you'll have to\n> update that function anyway, you can also fix the order there :-)\n> \n> > >\n> > > > +                     if (value.isArray()) {\n> > > > +                             Span<uint8_t> data = value.data();\n> > > > +                             v4l2Ctrl.p_u32 = reinterpret_cast<uint32_t *>(data.data());\n> > > > +                             v4l2Ctrl.size = data.size();\n> > > > +                     } else {\n> > > > +                             v4l2Ctrl.value = value.get<int32_t>();\n> > > > +                     }\n> > >\n> > > This looks fine, but I think you also need to update\n> > > V4L2Device::updateControls().\n> > \n> > Just to check (my understanding of how ControlLists work has always\n> > been a bit hazy...), the same logic will apply there as in the \"Byte\"\n> > case, i.e. I just need to check for the array type and then do\n> > nothing?\n> \n> That's correct. Actually, maybe the following would be more generic ?\n> \n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 1e26305742db..be66b8eb523a 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -671,6 +671,14 @@ void V4L2Device::updateControls(ControlList *ctrls,\n>  \t\tconst unsigned int id = v4l2Ctrl.id;\n> \n>  \t\tControlValue value = ctrls->get(id);\n> +\t\tif (value.isArray()) {\n> +\t\t\t/*\n> +\t\t\t * No action required, the VIDIOC_[GS]_EXT_CTRLS ioctl\n> +\t\t\t * accessed the ControlValue storage directly for array\n> +\t\t\t * controls.\n> +\t\t\t */\n> +\t\t\tcontinue;\n> +\t\t}\n> \n>  \t\tconst auto iter = controls_.find(id);\n>  \t\tASSERT(iter != controls_.end());\n> @@ -684,13 +692,6 @@ void V4L2Device::updateControls(ControlList *ctrls,\n>  \t\t\tvalue.set<int32_t>(v4l2Ctrl.value);\n>  \t\t\tbreak;\n> \n> -\t\tcase ControlTypeByte:\n> -\t\t\t/*\n> -\t\t\t * No action required, the VIDIOC_[GS]_EXT_CTRLS ioctl\n> -\t\t\t * accessed the ControlValue storage directly.\n> -\t\t\t */\n> -\t\t\tbreak;\n> -\n>  \t\tdefault:\n>  \t\t\t/*\n>  \t\t\t * \\todo To be changed when support for string controls\n\nOr even\n\n@@ -681,16 +689,6 @@ void V4L2Device::updateControls(ControlList *ctrls,\n \t\t\tbreak;\n\n \t\tcase ControlTypeInteger32:\n-\t\t\tvalue.set<int32_t>(v4l2Ctrl.value);\n-\t\t\tbreak;\n-\n-\t\tcase ControlTypeByte:\n-\t\t\t/*\n-\t\t\t * No action required, the VIDIOC_[GS]_EXT_CTRLS ioctl\n-\t\t\t * accessed the ControlValue storage directly.\n-\t\t\t */\n-\t\t\tbreak;\n-\n \t\tdefault:\n \t\t\t/*\n \t\t\t * \\todo To be changed when support for string controls\n\n\n> I haven't tested it, maybe I'm missing something.\n> \n> > > > +\n> > > > +                     break;\n> > > > +             }\n> > > > +\n> > > >               default:\n> > > >                       /* \\todo To be changed to support strings. */\n> > > >                       v4l2Ctrl.value = value.get<int32_t>();","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 AEA1DBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Dec 2021 16:30:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1DC6C60913;\n\tThu, 30 Dec 2021 17:30:31 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3432B60115\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Dec 2021 17:30:30 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A9C7B2A5;\n\tThu, 30 Dec 2021 17:30:29 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"hTv00dv9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640881829;\n\tbh=JViMYZIySqhsvhq0+k/m1UO326ZknjOOFyeREAgXpBs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hTv00dv9ko/um82t0HegT1sCl1LkkXcKZ8IM+aO26nTcKwUaVeLPK05VHVEpJTMzJ\n\t3nb7khH39cjgSax+xNVTAZYOmmzbQMK34wXm8pHgvhMBeB4qsNOA3Pi/+uh+1pVd5o\n\tyMCj2HWSGfjrbZO25cRoA40xMfsBeQzAMOZnE7mk=","Date":"Thu, 30 Dec 2021 18:30:28 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Message-ID":"<Yc3epJt5F0jzAyxp@pendragon.ideasonboard.com>","References":"<20211223080110.9766-1-david.plowman@raspberrypi.com>\n\t<20211223080110.9766-3-david.plowman@raspberrypi.com>\n\t<YcU7lkGSq2HRcsLp@pendragon.ideasonboard.com>\n\t<CAHW6GYJwc=xXvofBFiseP7H_wKHDp4tqrccuPppQpcjKzEf1Eg@mail.gmail.com>\n\t<Yc3cx7pK2JXhWL6x@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<Yc3cx7pK2JXhWL6x@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: v4l2_device: Add\n\tsupport for integer array controls","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]