Show a patch.

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

{
    "id": 3076,
    "url": "https://patchwork.libcamera.org/api/patches/3076/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3076/",
    "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": "<20200309162414.720306-12-jacopo@jmondi.org>",
    "date": "2020-03-09T16:24:14",
    "name": "[libcamera-devel,11/11] test: v4l2_videodevice: Test U8 array controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "2847cad8a6a5ec0d22df1adf36272562bc71c399",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3076/mbox/",
    "series": [
        {
            "id": 716,
            "url": "https://patchwork.libcamera.org/api/series/716/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=716",
            "date": "2020-03-09T16:24:03",
            "name": "Adda support for V4L2 array control and strings",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/716/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3076/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3076/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8091C62940\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Mar 2020 17:21:32 +0100 (CET)",
            "from uno.lan (93-34-114-233.ip49.fastwebnet.it [93.34.114.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 2D25E60015\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Mar 2020 16:21:31 +0000 (UTC)"
        ],
        "X-Originating-IP": "93.34.114.233",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  9 Mar 2020 17:24:14 +0100",
        "Message-Id": "<20200309162414.720306-12-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.25.0",
        "In-Reply-To": "<20200309162414.720306-1-jacopo@jmondi.org>",
        "References": "<20200309162414.720306-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 11/11] 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": "Mon, 09 Mar 2020 16:21:33 -0000"
    },
    "content": "Test V4L2 array control using vivid control VIVID_CID_U8_4D_ARRAY.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n test/v4l2_videodevice/controls.cpp | 31 +++++++++++++++++++++++++++++-\n 1 file changed, 30 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp\nindex 478de3707a3c..e2601b7594bb 100644\n--- a/test/v4l2_videodevice/controls.cpp\n+++ b/test/v4l2_videodevice/controls.cpp\n@@ -5,6 +5,7 @@\n  * controls.cpp - V4L2 device controls handling test\n  */\n \n+#include <array>\n #include <iostream>\n #include <limits.h>\n \n@@ -12,6 +13,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 +44,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,6 +53,7 @@ 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@@ -51,6 +61,10 @@ protected:\n \t\tctrls.set(V4L2_CID_CONTRAST, -1);\n \t\tctrls.set(V4L2_CID_SATURATION, -1);\n \n+\t\tstd::array<uint8_t, VIVID_CID_U8_ARRAY_SIZE> u8Values;\n+\t\tSpan<const uint8_t> u8Span(u8Values);\n+\t\tctrls.set(VIVID_CID_U8_4D_ARRAY, u8Span);\n+\n \t\tint ret = capture_->getControls(&ctrls);\n \t\tif (ret) {\n \t\t\tcerr << \"Failed to get controls\" << endl;\n@@ -64,11 +78,26 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\tu8Span = ctrls.get(VIVID_CID_U8_4D_ARRAY).get<Span<const uint8_t>>();\n+\t\tfor (unsigned int i = 0; i < VIVID_CID_U8_ARRAY_SIZE; ++i) {\n+\t\t\tif (u8Span[i] != 0)\n+\t\t\t\tcontinue;\n+\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\tfor (unsigned int i = 0; i < VIVID_CID_U8_ARRAY_SIZE; ++i)\n+\t\t\tu8Values[i] = u8.min().get<uint8_t>();\n+\t\tu8Span = u8Values;\n+\t\tctrls.set(VIVID_CID_U8_4D_ARRAY, u8Span);\n+\n \t\tret = capture_->setControls(&ctrls);\n \t\tif (ret) {\n \t\t\tcerr << \"Failed to set controls\" << endl;\n",
    "prefixes": [
        "libcamera-devel",
        "11/11"
    ]
}