Show a patch.

GET /api/1.1/patches/2137/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2137,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2137/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2137/",
    "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": "<20191007224642.6597-10-laurent.pinchart@ideasonboard.com>",
    "date": "2019-10-07T22:46:42",
    "name": "[libcamera-devel,9/9] libcamera: v4l2_controls: Add control validator",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c22566c67507585f10d2abe55ef4335eecbf2b0a",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2137/mbox/",
    "series": [
        {
            "id": 526,
            "url": "https://patchwork.libcamera.org/api/1.1/series/526/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=526",
            "date": "2019-10-07T22:46:33",
            "name": "Use ControlList for both libcamera and V4L2 controls",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/526/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2137/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2137/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 951E36197A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Oct 2019 00:46:59 +0200 (CEST)",
            "from pendragon.ideasonboard.com\n\t(modemcable118.64-20-96.mc.videotron.ca [96.20.64.118])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CEE59B2D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Oct 2019 00:46:58 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1570488419;\n\tbh=bLkfjQh9qvSAmLcrRWH0Cq5MipYCnwfXqr0Dg5tI6cU=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=IGQZIKopdc7LmCLazWjeZ2fpVuip6VGAZjsnpzb37jcxbdo2k9Ho2l+OxkAyyGDQv\n\teftHuP/xgoweq/EGh6ud2jSTgBrJeVjGd/DDARGT4OX+0X01dRszqpjUIEvuL5HEhT\n\tIPBGiUKY+O8By9qdTMguJzrZINHJ981fvQMELCho=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  8 Oct 2019 01:46:42 +0300",
        "Message-Id": "<20191007224642.6597-10-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20191007224642.6597-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20191007224642.6597-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 9/9] libcamera: v4l2_controls: Add control\n\tvalidator",
        "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>",
        "X-List-Received-Date": "Mon, 07 Oct 2019 22:47:00 -0000"
    },
    "content": "Add a ControlValidator specialisation that validates controls based on a\nV4L2 device.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/v4l2_controls.h | 14 ++++++++++++\n src/libcamera/v4l2_controls.cpp       | 33 +++++++++++++++++++++++++++\n 2 files changed, 47 insertions(+)",
    "diff": "diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h\nindex 133ab9ec208b..5fd92e3ac4e5 100644\n--- a/src/libcamera/include/v4l2_controls.h\n+++ b/src/libcamera/include/v4l2_controls.h\n@@ -17,6 +17,8 @@\n \n #include <libcamera/controls.h>\n \n+#include \"control_validator.h\"\n+\n namespace libcamera {\n \n class V4L2ControlId : public ControlId\n@@ -57,6 +59,18 @@ private:\n \tconst V4L2ControlInfoMap &controls_;\n };\n \n+class V4L2ControlValidator final : public ControlValidator\n+{\n+public:\n+\tV4L2ControlValidator(V4L2Device *device);\n+\n+\tconst std::string &name() const override;\n+\tbool validate(const ControlId &id) const override;\n+\n+private:\n+\tV4L2Device *dev_;\n+};\n+\n } /* namespace libcamera */\n \n #endif /* __LIBCAMERA_V4L2_CONTROLS_H__ */\ndiff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp\nindex d3f94709e821..498567ee0bf0 100644\n--- a/src/libcamera/v4l2_controls.cpp\n+++ b/src/libcamera/v4l2_controls.cpp\n@@ -239,4 +239,37 @@ void V4L2ControlList::set(unsigned int id, const ControlValue &value)\n \tControlList::set(ctrl->second.id(), value);\n }\n \n+/**\n+ * \\class V4L2ControlValidator\n+ * \\brief A control validator for V4L2Devoe instances\n+ *\n+ * This ControlValidator specialisation validates that controls exist in the\n+ * V4L2Device associated with the validator.\n+ */\n+\n+/**\n+ * \\brief Construst a V4L2ControlValidator for the V4L2 \\a device\n+ * \\param[in] device The V4L2 device\n+ */\n+V4L2ControlValidator::V4L2ControlValidator(V4L2Device *device)\n+\t: dev_(device)\n+{\n+}\n+\n+const std::string &V4L2ControlValidator::name() const\n+{\n+\treturn dev_->deviceNode();\n+}\n+\n+/**\n+ * \\brief Validate a control\n+ * \\param[in] id The control ID\n+ * \\return True if the control is valid, false otherwise\n+ */\n+bool V4L2ControlValidator::validate(const ControlId &id) const\n+{\n+\tconst V4L2ControlInfoMap &controls = dev_->controls();\n+\treturn controls.find(id.id()) != controls.end();\n+}\n+\n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "9/9"
    ]
}