Show a patch.

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

{
    "id": 3232,
    "url": "https://patchwork.libcamera.org/api/patches/3232/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3232/",
    "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": "<20200321003640.2156-5-laurent.pinchart@ideasonboard.com>",
    "date": "2020-03-21T00:36:37",
    "name": "[libcamera-devel,v2,4/7] libcamera: v4l2_device: Support reading U8 array controls",
    "commit_ref": "3786b6c84bbfa91864bfbd16fa8cad575e4247e7",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "0c0fe2b29d8da040acf8b4747def32b5e54dc09b",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3232/mbox/",
    "series": [
        {
            "id": 754,
            "url": "https://patchwork.libcamera.org/api/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/3232/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3232/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 33E4C62BBA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Mar 2020 01:36:52 +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 B4655A54;\n\tSat, 21 Mar 2020 01:36:51 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584751011;\n\tbh=WkVhICCZLGxluzQQoI6YYP/MJbEJ6X5+ql3oFelp9qs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=rfG70g7ltmePkCRu6LAoesrioP2+z/N4THAU0o1rUJkmrn6/iaiBGMNu9MuDx0dQ8\n\t4TJ8SlmsSvDQ7Ef16SQ/9Io+YcOGTl8P/ZCYBiRwQbgma8MM5imm+2uMPul9fEjRvp\n\tGMqUQzeBW4DHvbJHVoniUnCpXE1DytiPN5qm2i/A=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 21 Mar 2020 02:36:37 +0200",
        "Message-Id": "<20200321003640.2156-5-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 4/7] libcamera: v4l2_device: Support\n\treading U8 array 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:52 -0000"
    },
    "content": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nAdd support to retrieve the value of array controls of type\nV4L2_CTRL_TYPE_U8.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Use writable ControlValue storage directly for arrays in getControls()\n- Handle the control type more generically\n- Improve error message for unsupported types\n- Rename ctrlsInfo_ to controlInfo_\n---\n src/libcamera/v4l2_device.cpp | 27 ++++++++++++++++++++++++++-\n 1 file changed, 26 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 2139e98bc9b8..3c91eb3f9f97 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -176,7 +176,7 @@ int V4L2Device::getControls(ControlList *ctrls)\n \tmemset(v4l2Ctrls, 0, sizeof(v4l2Ctrls));\n \n \tunsigned int i = 0;\n-\tfor (const auto &ctrl : *ctrls) {\n+\tfor (auto &ctrl : *ctrls) {\n \t\tunsigned int id = ctrl.first;\n \t\tconst auto iter = controls_.find(id);\n \t\tif (iter == controls_.end()) {\n@@ -185,6 +185,31 @@ int V4L2Device::getControls(ControlList *ctrls)\n \t\t\treturn -EINVAL;\n \t\t}\n \n+\t\tconst struct v4l2_query_ext_ctrl &info = controlInfo_[id];\n+\t\tControlValue &value = ctrl.second;\n+\n+\t\tif (info.flags & V4L2_CTRL_FLAG_HAS_PAYLOAD) {\n+\t\t\tControlType type;\n+\n+\t\t\tswitch (info.type) {\n+\t\t\tcase V4L2_CTRL_TYPE_U8:\n+\t\t\t\ttype = ControlTypeByte;\n+\t\t\t\tbreak;\n+\n+\t\t\tdefault:\n+\t\t\t\tLOG(V4L2, Error)\n+\t\t\t\t\t<< \"Unsupported payload control type \"\n+\t\t\t\t\t<< info.type;\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\tvalue.reserve(type, true, info.elems);\n+\t\t\tSpan<uint8_t> data = value.data();\n+\n+\t\t\tv4l2Ctrls[i].p_u8 = data.data();\n+\t\t\tv4l2Ctrls[i].size = data.size();\n+\t\t}\n+\n \t\tv4l2Ctrls[i].id = id;\n \t\ti++;\n \t}\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "4/7"
    ]
}