Show a patch.

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

{
    "id": 3072,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3072/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3072/",
    "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": "<20200309162414.720306-9-jacopo@jmondi.org>",
    "date": "2020-03-09T16:24:11",
    "name": "[libcamera-devel,08/11] licamera: v4l2_device: Support reading U8 array controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9180d6b50fde32085c16d5e053f6979b1281617b",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": {
        "id": 15,
        "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api",
        "username": "jmondi",
        "first_name": "Jacopo",
        "last_name": "Mondi",
        "email": "jacopo@jmondi.org"
    },
    "mbox": "https://patchwork.libcamera.org/patch/3072/mbox/",
    "series": [
        {
            "id": 716,
            "url": "https://patchwork.libcamera.org/api/1.1/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/3072/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3072/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 2338362928\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Mar 2020 17:21:31 +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 E4C7D60016\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Mar 2020 16:21:30 +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:11 +0100",
        "Message-Id": "<20200309162414.720306-9-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 08/11] licamera: 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": "Mon, 09 Mar 2020 16:21:32 -0000"
    },
    "content": "Add support to retrieve the value of array controls of type\nV4L2_CTRL_TYPE_U8.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/v4l2_device.cpp | 26 ++++++++++++++++++++++++++\n 1 file changed, 26 insertions(+)",
    "diff": "diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 950e6286b84d..464df6a1fe18 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -185,6 +185,22 @@ int V4L2Device::getControls(ControlList *ctrls)\n \t\t\treturn -EINVAL;\n \t\t}\n \n+\t\tconst struct v4l2_query_ext_ctrl &info = ctrlsInfo_[id];\n+\t\tif (info.flags & V4L2_CTRL_FLAG_HAS_PAYLOAD) {\n+\t\t\tif (info.type != V4L2_CTRL_TYPE_U8) {\n+\t\t\t\t/*\n+\t\t\t\t * \\todo Fail loudly to notify support for\n+\t\t\t\t * other array control types is not implemented.\n+\t\t\t\t */\n+\t\t\t\tLOG(V4L2, Error) << \"Unsupported type\";\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\n+\t\t\tsize_t sizeBytes = info.elems * info.elem_size;\n+\t\t\tv4l2Ctrls[i].p_u8 = new uint8_t[sizeBytes];\n+\t\t\tv4l2Ctrls[i].size = sizeBytes;\n+\t\t}\n+\n \t\tv4l2Ctrls[i].id = id;\n \t\ti++;\n \t}\n@@ -214,6 +230,16 @@ int V4L2Device::getControls(ControlList *ctrls)\n \n \tupdateControls(ctrls, v4l2Ctrls, count);\n \n+\t/* Release memory reserved for array controls. */\n+\tfor (unsigned int i = 0; i < count; i++) {\n+\t\tunsigned int id = v4l2Ctrls[i].id;\n+\t\tconst struct v4l2_query_ext_ctrl &info = ctrlsInfo_[id];\n+\n+\t\t/* \\todo Adjust to support more array control types. */\n+\t\tif (info.flags & V4L2_CTRL_FLAG_HAS_PAYLOAD)\n+\t\t\tdelete[] v4l2Ctrls[i].p_u8;\n+\t}\n+\n \treturn ret;\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "08/11"
    ]
}