{"id":26328,"url":"https://patchwork.libcamera.org/api/patches/26328/?format=json","web_url":"https://patchwork.libcamera.org/patch/26328/","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":"<20260325092659.79453-1-barnabas.pocze@ideasonboard.com>","date":"2026-03-25T09:26:56","name":"[v1,1/4] libcamera: v4l2_device: Ensure consistent control types","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"94b50f5f1c3ef6cf1681b4d71daa5108f9c50ec4","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/26328/mbox/","series":[{"id":5844,"url":"https://patchwork.libcamera.org/api/series/5844/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5844","date":"2026-03-25T09:26:56","name":"[v1,1/4] libcamera: v4l2_device: Ensure consistent control types","version":1,"mbox":"https://patchwork.libcamera.org/series/5844/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/26328/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/26328/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 76412BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Mar 2026 09:27:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 73848627D7;\n\tWed, 25 Mar 2026 10:27:05 +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 0393F620FA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Mar 2026 10:27:03 +0100 (CET)","from pb-laptop.local (185.221.143.129.nat.pool.zt.hu\n\t[185.221.143.129])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 395E973B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Mar 2026 10:25:45 +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=\"O7HWW0HX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774430745;\n\tbh=ZSPrVpKXvBFDEDNq6fDg3VUw1BEtXcPeqxRW9q9uUa0=;\n\th=From:To:Subject:Date:From;\n\tb=O7HWW0HXEzjsxqaprJlVHsm3+PPmXou32p1yeV+06bhXyx1egSaWDA6PX8kTZtoOC\n\taLCnfzY8CQP60NhtaBCeZA/4wZ4eJlm6drPQMMY23VcD7UHFIHSHGh4+QBzgX+wGAb\n\tkdWksfmT6NQdVWaFzPRR6eZ6WLDtOApxehbwawEE=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v1 1/4] libcamera: v4l2_device: Ensure consistent control\n\ttypes","Date":"Wed, 25 Mar 2026 10:26:56 +0100","Message-ID":"<20260325092659.79453-1-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.53.0","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","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":"While `setControls()` uses the specific types, `updateControls()` converts\neverything to 32-bit integers (except 64-bit integers). This causes, for\nexample, that a 16-bit unsigned integer is retrieved as `int32_t` even\nthough there is a specific libcamera control type for it. What's even\nmore surprising is that setting such a control requires a `ControlValue`\nwith `uint16_t`, but when `setControls()` updates the list to contain\nthe actually applied values, it will now have type `int32_t`.\n\nSo make sure that `updateControls()` uses the appropriate type.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/libcamera/v4l2_device.cpp | 25 ++++++++++++++++---------\n 1 file changed, 16 insertions(+), 9 deletions(-)","diff":"diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 67bbaa037..e0099cb7a 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -823,19 +823,26 @@ void V4L2Device::updateControls(ControlList *ctrls,\n \t\tASSERT(iter != controls_.end());\n \n \t\tswitch (iter->first->type()) {\n+\t\tcase ControlTypeByte:\n+\t\t\tvalue.set<uint8_t>(v4l2Ctrl.value);\n+\t\t\tbreak;\n+\t\tcase ControlTypeUnsigned16:\n+\t\t\tvalue.set<uint16_t>(v4l2Ctrl.value);\n+\t\t\tbreak;\n+\t\tcase ControlTypeInteger32:\n+\t\t\tvalue.set<int32_t>(v4l2Ctrl.value);\n+\t\t\tbreak;\n+\t\tcase ControlTypeUnsigned32:\n+\t\t\tvalue.set<uint32_t>(v4l2Ctrl.value);\n+\t\t\tbreak;\n \t\tcase ControlTypeInteger64:\n \t\t\tvalue.set<int64_t>(v4l2Ctrl.value64);\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-\t\t\tvalue.set<int32_t>(v4l2Ctrl.value);\n-\t\t\tbreak;\n+\t\t\tLOG(V4L2, Error)\n+\t\t\t\t<< \"Control \" << utils::hex(id)\n+\t\t\t\t<< \" has unsupported type\";\n+\t\t\tcontinue;\n \t\t}\n \n \t\tctrls->set(id, value);\n","prefixes":["v1","1/4"]}