Patch Detail
Show a patch.
GET /api/patches/12495/?format=api
{ "id": 12495, "url": "https://patchwork.libcamera.org/api/patches/12495/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12495/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210607011402.55331-2-hiroh@chromium.org>", "date": "2021-06-07T01:13:58", "name": "[libcamera-devel,v7,2/6] libcamera: V4L2Device: Support v4l2 menu control", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "c77711761f0ee00ee038797ae70be38f6e543e42", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/12495/mbox/", "series": [ { "id": 2105, "url": "https://patchwork.libcamera.org/api/series/2105/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2105", "date": "2021-06-07T01:13:57", "name": "[libcamera-devel,v7,1/6] libcamera: controls: Add sensor test pattern mode", "version": 7, "mbox": "https://patchwork.libcamera.org/series/2105/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12495/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12495/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 AE378C320B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 7 Jun 2021 01:14:12 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A3F566892E;\n\tMon, 7 Jun 2021 03:14:11 +0200 (CEST)", "from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com\n\t[IPv6:2607:f8b0:4864:20::62f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B570268925\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 7 Jun 2021 03:14:10 +0200 (CEST)", "by mail-pl1-x62f.google.com with SMTP id v12so7716562plo.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 06 Jun 2021 18:14:10 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:6eb1:2d91:79ee:2043])\n\tby smtp.gmail.com with ESMTPSA id\n\th12sm7303655pgn.54.2021.06.06.18.14.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 06 Jun 2021 18:14:08 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"jJHB4uWS\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=nIXJzulVYV45F/GbsYfMi+KlzCrxZO8w1wziyYXO8mA=;\n\tb=jJHB4uWS9MQCiaqor9jjpoS70Ai39V1EFCfeyxjXj7MgpeiZmLdJlw+oGt7tISDCvA\n\tmdSQmEdaA64n+p8y7lgmJET+zhHJYM6xaau9OOrE4c7gwB0eJ8rzaxPUBcufpY5Pgeyq\n\tzv2jdQLRZOChZ5oxcSciSbsskMp1RXYv08x6I=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=nIXJzulVYV45F/GbsYfMi+KlzCrxZO8w1wziyYXO8mA=;\n\tb=MrCGysRS6IHC4zLC2q5DBZYhs+piGlzofPl5Lxz+R5kPp70jXjK/mncT6V22AfQ+o8\n\tAS5nv6Q7NmmehZ9dhn7wX4xNHjqvdtwL4EBCSgIJ6OQTpR/Kmz1HNN5gmTWzTUYFI0Xl\n\tRiLJSV9WASm3Eu1PidjblaEGI6CtX87Bd9b475ISJt1+XkfdaLpgIVszSmaTDv2+DnNm\n\tRQhH9YtEVgvSsrVbl8qbESf5UGQz5XytQyqpXRy+ZOjyfUWIF3/DDFJA2w91v+HXaqUD\n\t/6uZTcz4GejtmQvnvGChwaSZv0ZV7pNxt1oxzueq0Htxb4aXSTm1FUr/hRss3dWcxkyv\n\tbZGg==", "X-Gm-Message-State": "AOAM531GpSNHD1btyA3x8xNJf1uACWoQ/4/eYoHoRQEKAaDS709yKkel\n\txUyiZ7TaRVsnrGMJa4v++AxZoUV/QL5byQ==", "X-Google-Smtp-Source": "ABdhPJx9FL2pqdJ5LgAW9CdTtFNCMGfxqLpLQ7aFweyu5rwPLjLHsqeeCqZD0HnKaDe+kW3VbZ6M8g==", "X-Received": "by 2002:a17:902:8602:b029:10b:df79:d7ca with SMTP id\n\tf2-20020a1709028602b029010bdf79d7camr15524384plo.56.1623028448928; \n\tSun, 06 Jun 2021 18:14:08 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 7 Jun 2021 10:13:58 +0900", "Message-Id": "<20210607011402.55331-2-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.32.0.rc1.229.g3e70b5a671-goog", "In-Reply-To": "<20210607011402.55331-1-hiroh@chromium.org>", "References": "<20210607011402.55331-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v7 2/6] libcamera: V4L2Device: Support\n\tv4l2 menu control", "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": "This adds a support of v4l2 menu. The control info for v4l2 menu\ncontains indices without names and 64bit values of querymenu.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/internal/v4l2_device.h | 2 +\n src/libcamera/v4l2_device.cpp | 53 ++++++++++++++++++++++--\n 2 files changed, 51 insertions(+), 4 deletions(-)", "diff": "diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h\nindex b82e2a14..687be9b2 100644\n--- a/include/libcamera/internal/v4l2_device.h\n+++ b/include/libcamera/internal/v4l2_device.h\n@@ -56,6 +56,8 @@ protected:\n \tint fd() const { return fd_; }\n \n private:\n+\tControlInfo v4l2MenuControlInfo(const v4l2_query_ext_ctrl &ctrl);\n+\n \tvoid listControls();\n \tvoid updateControls(ControlList *ctrls,\n \t\t\t Span<const v4l2_ext_control> v4l2Ctrls);\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex b39c6266..40e2c74c 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -524,6 +524,38 @@ int V4L2Device::ioctl(unsigned long request, void *argp)\n * \\return The V4L2 device file descriptor, -1 if the device node is not open\n */\n \n+/**\n+ * \\brief Create ControlInfo for a V4L2 menu ctrl\n+ * \\param[in] ctrl The v4l2_query_ext_ctrl that represents a menu\n+ *\n+ * The created ControlInfo contains indices acquired by VIDIOC_QUERYMENU.\n+ *\n+ * \\return ControlInfo for a V4L2 menu ctrl.\n+ */\n+ControlInfo V4L2Device::v4l2MenuControlInfo(\n+\tconst struct v4l2_query_ext_ctrl &ctrl)\n+{\n+\tstd::vector<ControlValue> indices;\n+\tstruct v4l2_querymenu menu = {};\n+\tmenu.id = ctrl.id;\n+\n+\tif (ctrl.minimum < 0)\n+\t\treturn ControlInfo();\n+\n+\tControlValue def = {};\n+\tfor (int32_t index = ctrl.minimum; index <= ctrl.maximum; ++index) {\n+\t\tmenu.index = index;\n+\t\tif (ioctl(VIDIOC_QUERYMENU, &menu) != 0)\n+\t\t\tcontinue;\n+\n+\t\tindices.push_back(index);\n+\t\tif (index == ctrl.default_value)\n+\t\t\tdef = ControlValue(index);\n+\t}\n+\n+\treturn ControlInfo(indices, def);\n+}\n+\n /*\n * \\brief List and store information about all controls supported by the\n * V4L2 device\n@@ -533,7 +565,6 @@ void V4L2Device::listControls()\n \tControlInfoMap::Map ctrls;\n \tstruct v4l2_query_ext_ctrl ctrl = {};\n \n-\t/* \\todo Add support for menu controls. */\n \twhile (1) {\n \t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL |\n \t\t\t V4L2_CTRL_FLAG_NEXT_COMPOUND;\n@@ -544,16 +575,23 @@ void V4L2Device::listControls()\n \t\t ctrl.flags & V4L2_CTRL_FLAG_DISABLED)\n \t\t\tcontinue;\n \n+\t\tControlInfo ctrlInfo;\n+\n \t\tswitch (ctrl.type) {\n \t\tcase V4L2_CTRL_TYPE_INTEGER:\n \t\tcase V4L2_CTRL_TYPE_BOOLEAN:\n-\t\tcase V4L2_CTRL_TYPE_MENU:\n \t\tcase V4L2_CTRL_TYPE_BUTTON:\n \t\tcase V4L2_CTRL_TYPE_INTEGER64:\n \t\tcase V4L2_CTRL_TYPE_BITMASK:\n-\t\tcase V4L2_CTRL_TYPE_INTEGER_MENU:\n \t\tcase V4L2_CTRL_TYPE_U8:\n+\t\t\tctrlInfo = v4l2ControlInfo(ctrl);\n+\t\t\tbreak;\n+\n+\t\tcase V4L2_CTRL_TYPE_INTEGER_MENU:\n+\t\tcase V4L2_CTRL_TYPE_MENU:\n+\t\t\tctrlInfo = v4l2MenuControlInfo(ctrl);\n \t\t\tbreak;\n+\n \t\t/* \\todo Support other control types. */\n \t\tdefault:\n \t\t\tLOG(V4L2, Debug)\n@@ -562,10 +600,13 @@ void V4L2Device::listControls()\n \t\t\tcontinue;\n \t\t}\n \n+\t\tLOG(V4L2, Debug) << \"Control: \" << ctrl.name\n+\t\t\t\t << \" (\" << utils::hex(ctrl.id) << \")\";\n+\n \t\tcontrolIds_.emplace_back(v4l2ControlId(ctrl));\n \t\tcontrolInfo_.emplace(ctrl.id, ctrl);\n \n-\t\tctrls.emplace(controlIds_.back().get(), v4l2ControlInfo(ctrl));\n+\t\tctrls.emplace(controlIds_.back().get(), std::move(ctrlInfo));\n \t}\n \n \tcontrols_ = std::move(ctrls);\n@@ -630,6 +671,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", "prefixes": [ "libcamera-devel", "v7", "2/6" ] }