Patch Detail
Show a patch.
GET /api/1.1/patches/17936/?format=api
{ "id": 17936, "url": "https://patchwork.libcamera.org/api/1.1/patches/17936/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17936/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20221202124005.3643-2-naush@raspberrypi.com>", "date": "2022-12-02T12:40:04", "name": "[libcamera-devel,v2,1/2] libcamera: controls: Add read-only flag to ControlInfo", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "cc0b13c4d80dc3e2a469e675067ad570a159c02f", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17936/mbox/", "series": [ { "id": 3654, "url": "https://patchwork.libcamera.org/api/1.1/series/3654/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3654", "date": "2022-12-02T12:40:03", "name": "Add read-only flag to ControlInfo", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3654/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17936/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17936/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 02D46C3284\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 2 Dec 2022 12:40:10 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7FBEE63336;\n\tFri, 2 Dec 2022 13:40:09 +0100 (CET)", "from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A9CDA60483\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 2 Dec 2022 13:40:07 +0100 (CET)", "by mail-wr1-x434.google.com with SMTP id q7so7611553wrr.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 02 Dec 2022 04:40:07 -0800 (PST)", "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ty15-20020a5d4acf000000b00241e5b917d0sm8276484wrs.36.2022.12.02.04.40.06\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 02 Dec 2022 04:40:06 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669984809;\n\tbh=TgaFrZ36pHsllxeDpzU5ir7opt1PrTmJN2JU+duPlhA=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=pur7SYgViFZ0v1PR65iwLFkh3YyQJib2NX3Lu2zKbrMyuLDrZuJg/9UWfoD0dLJhh\n\tiOD+GlrMC1I0+uuARVRQ4KXHMeZmYhk1xJ4S0XynIzMG60F/qGBytMq93L5yWIs4r2\n\tvN+S3bfspiAg0rHv0SdqtMEw1/KOQNekJadggnsZkWBHb0pplQ0iwDskKHmEObdtea\n\tr6SHyKYFSbwov1qOc5ceHafZ90Wc8+ZAGg7M8UXlIqW6JieIa8sEVv79wBQqgSgSUz\n\tLVlIo60fPau7zv3eLe8l7xFSuoZiTiX4qyngCc8DfYLOolVuIx0E/NKf9veDqzh313\n\t+zlF1Gm8vxo0Q==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=c643d3iJZKcn3dtADXotC7fEYERhkVq2zGvRgdDFG3s=;\n\tb=LHgiyzKrg8RquYMmNnZTV9w6vWzwrYNCxZu/fVo0jt8m0nQ7KaXXcRnZt3XNDbO+V7\n\t1UHetRJ9vVIAe7oA0X6tLYt7Pg/FtT5PQhV+jbDGU0GuD7jtXzi5pdWn8+HsZ4QKuW86\n\tg948iFah/8U1IVZl5a+HZHy/RMM0m1HdM3ikFZ0JGUKvIyPHck0hZJXayT9KPyud/lna\n\t3Q3cNR5a7zazt/bI4SjBymhE/gVIGPx8XbyafLY3wvB5XmSPjd2SmP0rnytsbKqt9TZj\n\txkj46ZX7KZe3bPKYgU2hd2D89Og0IVlGfCwlp3qWSO5JAgsz6x63oN1WjNKN/WVoj89/\n\tXmSQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"LHgiyzKr\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=c643d3iJZKcn3dtADXotC7fEYERhkVq2zGvRgdDFG3s=;\n\tb=MbynJfhh+8Vu2A16YSmwkTuNXvq0VYxoXZ455vEM33enbAOU1YRzvXDothoRT/2IWZ\n\tpx9CXVfxqqYkq4sNZXr40OM2Ay8vwf5VgHyWo9n1OgyNTNALjONTS6ImGsjct6ctJ/hp\n\tLZ6++c2GqKD+xPldNKpTY1g3RYTnvkrD9wK4WaekUmVhJRYN1x1EzFNyY4TlWFrWfKYf\n\tQEVr3u1gsv4RtB6aEXPsrHk/AdWGgpR6dwCxl8wfI86pSH7B+SCZQXuoSNSvXSQeWHpY\n\tz8npq0/WLDVGIaus6ycf4EYeJGw/Hfz2KCvjla8e3OybMtWVvZsvdXKGmcOnFmE7KeFs\n\tfQpg==", "X-Gm-Message-State": "ANoB5pklXHJOVn8f+7ql0hs7ohi3E9Lq9/OkR9rS+HF7POLdHEJx8p6d\n\tzcXMONNs35vE2NuN7szNJDPlGgEccP1PCUuO", "X-Google-Smtp-Source": "AA0mqf7XAXVw/Flyqq/qmEbOLIuKNgJW0XDi1hqswxsbGoXpmDqVVl6Ip7AfpmhewNvo76Tq9NKm8g==", "X-Received": "by 2002:adf:e78d:0:b0:241:d3e4:6544 with SMTP id\n\tn13-20020adfe78d000000b00241d3e46544mr18654900wrm.533.1669984807178; \n\tFri, 02 Dec 2022 04:40:07 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 2 Dec 2022 12:40:04 +0000", "Message-Id": "<20221202124005.3643-2-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20221202124005.3643-1-naush@raspberrypi.com>", "References": "<20221202124005.3643-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 1/2] libcamera: controls: Add read-only\n\tflag to ControlInfo", "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>", "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Naushir Patuck <naush@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a read-only flag to the ControlInfo flag to indicate whether a V4L2 control\nis read-only or not. This flag only makes sense for V2L2 controls at preset, so\nonly update the ControlInfo constructor signature used by the V4L2Device class\nto set the value of the flag.\n\nAdd a ControlInfo::readOnly() member function to retrive this flag.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/controls.h | 5 ++++-\n src/libcamera/controls.cpp | 17 +++++++++++++----\n src/libcamera/v4l2_device.cpp | 12 ++++++++----\n 3 files changed, 25 insertions(+), 9 deletions(-)", "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex cf94205577a5..488663a7ba04 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -270,7 +270,8 @@ class ControlInfo\n public:\n \texplicit ControlInfo(const ControlValue &min = {},\n \t\t\t const ControlValue &max = {},\n-\t\t\t const ControlValue &def = {});\n+\t\t\t const ControlValue &def = {},\n+\t\t\t bool readOnly = false);\n \texplicit ControlInfo(Span<const ControlValue> values,\n \t\t\t const ControlValue &def = {});\n \texplicit ControlInfo(std::set<bool> values, bool def);\n@@ -279,6 +280,7 @@ public:\n \tconst ControlValue &min() const { return min_; }\n \tconst ControlValue &max() const { return max_; }\n \tconst ControlValue &def() const { return def_; }\n+\tbool readOnly() const { return readOnly_; }\n \tconst std::vector<ControlValue> &values() const { return values_; }\n \n \tstd::string toString() const;\n@@ -297,6 +299,7 @@ private:\n \tControlValue min_;\n \tControlValue max_;\n \tControlValue def_;\n+\tbool readOnly_;\n \tstd::vector<ControlValue> values_;\n };\n \ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 6dbf9b348709..fc66abad600d 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -484,11 +484,13 @@ void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElemen\n * \\param[in] min The control minimum value\n * \\param[in] max The control maximum value\n * \\param[in] def The control default value\n+ * \\param[in] readOnly Read-only status of a V4L2 control\n */\n ControlInfo::ControlInfo(const ControlValue &min,\n \t\t\t const ControlValue &max,\n-\t\t\t const ControlValue &def)\n-\t: min_(min), max_(max), def_(def)\n+\t\t\t const ControlValue &def,\n+\t\t\t bool readOnly)\n+\t: min_(min), max_(max), def_(def), readOnly_(readOnly)\n {\n }\n \n@@ -525,7 +527,8 @@ ControlInfo::ControlInfo(Span<const ControlValue> values,\n * default value is \\a def.\n */\n ControlInfo::ControlInfo(std::set<bool> values, bool def)\n-\t: min_(false), max_(true), def_(def), values_({ false, true })\n+\t: min_(false), max_(true), def_(def), readOnly_(false),\n+\t values_({ false, true })\n {\n \tASSERT(values.count(def) && values.size() == 2);\n }\n@@ -538,7 +541,7 @@ ControlInfo::ControlInfo(std::set<bool> values, bool def)\n * value. The minimum, maximum, and default values will all be \\a value.\n */\n ControlInfo::ControlInfo(bool value)\n-\t: min_(value), max_(value), def_(value)\n+\t: min_(value), max_(value), def_(value), readOnly_(false)\n {\n \tvalues_ = { value };\n }\n@@ -571,6 +574,12 @@ ControlInfo::ControlInfo(bool value)\n * \\return A ControlValue with the default value for the control\n */\n \n+/**\n+ * \\fn ControlInfo::readOnly()\n+ * \\brief Identifies if a V4L2 control is flagged as read-only\n+ * \\return True if the V4L2 control is read-only, false otherwise\n+ */\n+\n /**\n * \\fn ControlInfo::values()\n * \\brief Retrieve the list of valid values\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 57a88d96b12c..9018f1b0b9e1 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -535,17 +535,20 @@ std::optional<ControlInfo> V4L2Device::v4l2ControlInfo(const v4l2_query_ext_ctrl\n \tcase V4L2_CTRL_TYPE_U8:\n \t\treturn ControlInfo(static_cast<uint8_t>(ctrl.minimum),\n \t\t\t\t static_cast<uint8_t>(ctrl.maximum),\n-\t\t\t\t static_cast<uint8_t>(ctrl.default_value));\n+\t\t\t\t static_cast<uint8_t>(ctrl.default_value),\n+\t\t\t\t !!(ctrl.flags & V4L2_CTRL_FLAG_READ_ONLY));\n \n \tcase V4L2_CTRL_TYPE_BOOLEAN:\n \t\treturn ControlInfo(static_cast<bool>(ctrl.minimum),\n \t\t\t\t static_cast<bool>(ctrl.maximum),\n-\t\t\t\t static_cast<bool>(ctrl.default_value));\n+\t\t\t\t static_cast<bool>(ctrl.default_value),\n+\t\t\t\t !!(ctrl.flags & V4L2_CTRL_FLAG_READ_ONLY));\n \n \tcase V4L2_CTRL_TYPE_INTEGER64:\n \t\treturn ControlInfo(static_cast<int64_t>(ctrl.minimum),\n \t\t\t\t static_cast<int64_t>(ctrl.maximum),\n-\t\t\t\t static_cast<int64_t>(ctrl.default_value));\n+\t\t\t\t static_cast<int64_t>(ctrl.default_value),\n+\t\t\t\t !!(ctrl.flags & V4L2_CTRL_FLAG_READ_ONLY));\n \n \tcase V4L2_CTRL_TYPE_INTEGER_MENU:\n \tcase V4L2_CTRL_TYPE_MENU:\n@@ -554,7 +557,8 @@ std::optional<ControlInfo> V4L2Device::v4l2ControlInfo(const v4l2_query_ext_ctrl\n \tdefault:\n \t\treturn ControlInfo(static_cast<int32_t>(ctrl.minimum),\n \t\t\t\t static_cast<int32_t>(ctrl.maximum),\n-\t\t\t\t static_cast<int32_t>(ctrl.default_value));\n+\t\t\t\t static_cast<int32_t>(ctrl.default_value),\n+\t\t\t\t !!(ctrl.flags & V4L2_CTRL_FLAG_READ_ONLY));\n \t}\n }\n \n", "prefixes": [ "libcamera-devel", "v2", "1/2" ] }