Show a patch.

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

{
    "id": 3235,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3235/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3235/",
    "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": "<20200321003640.2156-8-laurent.pinchart@ideasonboard.com>",
    "date": "2020-03-21T00:36:40",
    "name": "[libcamera-devel,v2,7/7] test: v4l2_videodevice: Test U8 array controls",
    "commit_ref": "c153be4fecbe01364010fe4c6b5ce835e081d1c4",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "5c8b3de6a52cee713fb0fa52d03929be72068df9",
    "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/3235/mbox/",
    "series": [
        {
            "id": 754,
            "url": "https://patchwork.libcamera.org/api/1.1/series/754/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=754",
            "date": "2020-03-21T00:36:33",
            "name": "Add support for V4L2 array controls",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/754/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3235/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3235/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "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 5161460417\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Mar 2020 01:36:53 +0100 (CET)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E058813C2;\n\tSat, 21 Mar 2020 01:36:52 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584751013;\n\tbh=u6GRWgZptZJUm8GwP2bbv31pja9xaDi8JNeyq9Bohnc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=o8trWShn7b5gXUUEbjwUU32cZxDh+zpZ1FxhH1+7ikTaBsLZ20UkV+aF4+AN6ivnV\n\t7iPD8weptEPSMCJ06bzgh135/oOvf5I/Y3LyS5bj32+HbSe3ynN23modtLHI/ntNGB\n\tZzD18RV//EoTL0ZBL7lW7XLJ7bohadD1vyiXEqyg=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 21 Mar 2020 02:36:40 +0200",
        "Message-Id": "<20200321003640.2156-8-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200321003640.2156-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200321003640.2156-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 7/7] test: v4l2_videodevice: Test U8\n\tarray 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>",
        "X-List-Received-Date": "Sat, 21 Mar 2020 00:36:53 -0000"
    },
    "content": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nTest V4L2 array control using vivid control VIVID_CID_U8_4D_ARRAY.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Add missing period in comment\n- Use <algorithm>\n- Don't set array value for VIVID_CID_U8_4D_ARRAY before getControls()\n---\n test/v4l2_videodevice/controls.cpp | 30 +++++++++++++++++++++++++++++-\n 1 file changed, 29 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp\nindex 478de3707a3c..da9e0111e221 100644\n--- a/test/v4l2_videodevice/controls.cpp\n+++ b/test/v4l2_videodevice/controls.cpp\n@@ -5,6 +5,8 @@\n  * controls.cpp - V4L2 device controls handling test\n  */\n \n+#include <algorithm>\n+#include <array>\n #include <iostream>\n #include <limits.h>\n \n@@ -12,6 +14,13 @@\n \n #include \"v4l2_videodevice_test.h\"\n \n+/* These come from the vivid driver. */\n+#define VIVID_CID_CUSTOM_BASE\t\t(V4L2_CID_USER_BASE | 0xf000)\n+#define VIVID_CID_U8_4D_ARRAY\t\t(VIVID_CID_CUSTOM_BASE + 10)\n+\n+/* Helper for VIVID_CID_U8_4D_ARRAY control array size: not from kernel. */\n+#define VIVID_CID_U8_ARRAY_SIZE\t\t(2 * 3 * 4 * 5)\n+\n using namespace std;\n using namespace libcamera;\n \n@@ -36,7 +45,8 @@ protected:\n \n \t\tif (infoMap.find(V4L2_CID_BRIGHTNESS) == infoMap.end() ||\n \t\t    infoMap.find(V4L2_CID_CONTRAST) == infoMap.end() ||\n-\t\t    infoMap.find(V4L2_CID_SATURATION) == infoMap.end()) {\n+\t\t    infoMap.find(V4L2_CID_SATURATION) == infoMap.end() ||\n+\t\t    infoMap.find(VIVID_CID_U8_4D_ARRAY) == infoMap.end()) {\n \t\t\tcerr << \"Missing controls\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n@@ -44,12 +54,14 @@ protected:\n \t\tconst ControlInfo &brightness = infoMap.find(V4L2_CID_BRIGHTNESS)->second;\n \t\tconst ControlInfo &contrast = infoMap.find(V4L2_CID_CONTRAST)->second;\n \t\tconst ControlInfo &saturation = infoMap.find(V4L2_CID_SATURATION)->second;\n+\t\tconst ControlInfo &u8 = infoMap.find(VIVID_CID_U8_4D_ARRAY)->second;\n \n \t\t/* Test getting controls. */\n \t\tControlList ctrls(infoMap);\n \t\tctrls.set(V4L2_CID_BRIGHTNESS, -1);\n \t\tctrls.set(V4L2_CID_CONTRAST, -1);\n \t\tctrls.set(V4L2_CID_SATURATION, -1);\n+\t\tctrls.set(VIVID_CID_U8_4D_ARRAY, 0);\n \n \t\tint ret = capture_->getControls(&ctrls);\n \t\tif (ret) {\n@@ -64,11 +76,27 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\tuint8_t u8Min = u8.min().get<uint8_t>();\n+\t\tuint8_t u8Max = u8.max().get<uint8_t>();\n+\n+\t\tSpan<const uint8_t> u8Span = ctrls.get(VIVID_CID_U8_4D_ARRAY).get<Span<const uint8_t>>();\n+\t\tbool valid = std::all_of(u8Span.begin(), u8Span.end(),\n+\t\t\t\t\t [&](uint8_t v) { return v >= u8Min && v <= u8Max; });\n+\t\tif (!valid) {\n+\t\t\tcerr << \"Incorrect value for retrieved array control\"\n+\t\t\t     << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\t/* Test setting controls. */\n \t\tctrls.set(V4L2_CID_BRIGHTNESS, brightness.min());\n \t\tctrls.set(V4L2_CID_CONTRAST, contrast.max());\n \t\tctrls.set(V4L2_CID_SATURATION, saturation.min());\n \n+\t\tstd::array<uint8_t, VIVID_CID_U8_ARRAY_SIZE> u8Values;\n+\t\tstd::fill(u8Values.begin(), u8Values.end(), u8.min().get<uint8_t>());\n+\t\tctrls.set(VIVID_CID_U8_4D_ARRAY, Span<const uint8_t>(u8Values));\n+\n \t\tret = capture_->setControls(&ctrls);\n \t\tif (ret) {\n \t\t\tcerr << \"Failed to set controls\" << endl;\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "7/7"
    ]
}