{"id":15248,"url":"https://patchwork.libcamera.org/api/patches/15248/?format=json","web_url":"https://patchwork.libcamera.org/patch/15248/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220105085553.12092-3-david.plowman@raspberrypi.com>","date":"2022-01-05T08:55:52","name":"[libcamera-devel,v2,2/3] libcamera: v4l2_device: Add support for integer array controls","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"719d67dea6b785ccfd8a2190a04d31beb8e3a089","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15248/mbox/","series":[{"id":2878,"url":"https://patchwork.libcamera.org/api/series/2878/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2878","date":"2022-01-05T08:55:50","name":"Make use of V4L2_CID_NOTIFY_GAINS","version":2,"mbox":"https://patchwork.libcamera.org/series/2878/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15248/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15248/checks/","tags":{},"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 B9162BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Jan 2022 08:56:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1141460115;\n\tWed,  5 Jan 2022 09:56:12 +0100 (CET)","from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com\n\t[IPv6:2a00:1450:4864:20::42b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6158460115\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Jan 2022 09:56:10 +0100 (CET)","by mail-wr1-x42b.google.com with SMTP id v6so19771205wra.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 05 Jan 2022 00:56:10 -0800 (PST)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tg8sm1902149wmh.17.2022.01.05.00.56.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 05 Jan 2022 00:56:09 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"puIg60in\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=u2r3xEi0YzrKc72HdK90OSSw8ISFH/rPRO4NU4VKhDM=;\n\tb=puIg60insYPIiQxdEJcy1j1MaKtlkVV4pGZ48gSgezso90gpDN/SokRBHHQ515HT0u\n\t4bttYP10tYxXBJE4ty3Slcvw+F8J85sznCGJFb24c+7LQe18UWCFhFiukyVmMz4XUZby\n\tHhQ18zvDlCT1wpnnbdxg6DqztIGvODOIN8Ury0gYQOwNyjgw61b0wSnqQYudD/F31cOY\n\t+plP7HPcSjD5ZfbZy1ynUEQYA46dwvtoKGJa+A1NSIkgY1eCG3+YHNAUx9oQaepaFtiT\n\thfgxlvRfRvRq0Jx58oiV/WbDhLL52GmMEJYk8kYomRj5bjtjJAvq+od6m07GPgq5L2sU\n\txGIQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=u2r3xEi0YzrKc72HdK90OSSw8ISFH/rPRO4NU4VKhDM=;\n\tb=vSOaj2sL2VA+gy3l5ciGQqeRh6KCYk85K4ZmwNPpP2bCSkHiDgUOQ1cwq5ZN5Clg8z\n\tFLsDg4NG8lq36yYAVEF7kCaOEi+NJTTa2FSLZ9prDOR7nRB7NZ7Bjs1VkkQ2SjWiAJGj\n\tS9ZQKKIzRrG4ehBrCX312fYK2WLLOOPlcOgEDjw0NoynDIpMF8wbP+WoAv7pcHfEcTdE\n\thUIuwMZToZjejDwnHmSnB7fEtgaWijqzqTd4L231wDcxScEbCYtNRoMT9Y1Ab8egoTKW\n\tsM4RgbqVDz0hyRu73/+VJ8afbq8pdp0I2/Xp7RVmX1UFohxO1UDZzFJwjzuLSveEf8kg\n\tBUAQ==","X-Gm-Message-State":"AOAM531g86sdR4F1DZ6eBTq+XRve+7dPa6ts3EcrU3zNTWGe1q5aKYhO\n\tT4dZqR8vtNedRQayPUz/b2xZ7tYA+g2F+KCB","X-Google-Smtp-Source":"ABdhPJwTxNzuF5wk2Mb1Ng6xoyWlYYpzyWhcFFfF+9+Azyicu8DmJ5D5T19u/EXSlrZPoIl4KZFH2g==","X-Received":"by 2002:a05:6000:186e:: with SMTP id\n\td14mr47195769wri.205.1641372969989; \n\tWed, 05 Jan 2022 00:56:09 -0800 (PST)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  5 Jan 2022 08:55:52 +0000","Message-Id":"<20220105085553.12092-3-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20220105085553.12092-1-david.plowman@raspberrypi.com>","References":"<20220105085553.12092-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"V4L2Device::setControl and V4L2Device::updateControl are both updated\nto handle ControlTypeInteger32 array controls.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/v4l2_device.cpp | 33 ++++++++++++++++++++++-----------\n 1 file changed, 22 insertions(+), 11 deletions(-)","diff":"diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 62c91779..3fc8438f 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -297,6 +297,18 @@ int V4L2Device::setControls(ControlList *ctrls)\n \t\t/* Set the v4l2_ext_control value for the write operation. */\n \t\tControlValue &value = ctrl->second;\n \t\tswitch (iter->first->type()) {\n+\t\tcase ControlTypeInteger32: {\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+\n+\t\t\tbreak;\n+\t\t}\n+\n \t\tcase ControlTypeInteger64:\n \t\t\tv4l2Ctrl.value64 = value.get<int64_t>();\n \t\t\tbreak;\n@@ -671,6 +683,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@@ -680,19 +700,10 @@ void V4L2Device::updateControls(ControlList *ctrls,\n \t\t\tvalue.set<int64_t>(v4l2Ctrl.value64);\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 * Note: this catches the ControlTypeInteger32 case.\n+\t\t\t *\n \t\t\t * \\todo To be changed when support for string controls\n \t\t\t * will be added.\n \t\t\t */\n","prefixes":["libcamera-devel","v2","2/3"]}