Show a patch.

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

{
    "id": 21265,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21265/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21265/",
    "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": "<01020191ec7e0ad5-37e0d829-4553-4d41-8063-37af6c08c380-000000@eu-west-1.amazonses.com>",
    "date": "2024-09-13T17:46:08",
    "name": "libcamera: pipeline: uvcvideo: Retrieve v4l2 device control information",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "af6f97103a58d13fbb96ac8fc486306a12691c0e",
    "submitter": {
        "id": 207,
        "url": "https://patchwork.libcamera.org/api/1.1/people/207/?format=api",
        "name": "Cláudio Paulo",
        "email": "claudio.paulo@makewise.pt"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21265/mbox/",
    "series": [
        {
            "id": 4592,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4592/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4592",
            "date": "2024-09-13T17:46:08",
            "name": "libcamera: pipeline: uvcvideo: Retrieve v4l2 device control information",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4592/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21265/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21265/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AA7D6C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Sep 2024 17:46:12 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6FA6F634F8;\n\tFri, 13 Sep 2024 19:46:11 +0200 (CEST)",
            "from a7-20.smtp-out.eu-west-1.amazonses.com\n\t(a7-20.smtp-out.eu-west-1.amazonses.com [54.240.7.20])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 44114634E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Sep 2024 19:46:10 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=makewise.pt header.i=@makewise.pt\n\theader.b=\"ncXZJdp3\"; dkim=pass (1024-bit key;\n\tunprotected) header.d=amazonses.com header.i=@amazonses.com\n\theader.b=\"YAdCBSvB\"; dkim-atps=neutral",
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;\n\ts=4ymqmigrodjwq5luewph2eedidgwlpqq; d=makewise.pt; t=1726249569;\n\th=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type:Content-Transfer-Encoding;\n\tbh=JH5D+nAlVtZPXcWvi8cjEkTpNJjf4VBKppmK/kZY1Dc=;\n\tb=ncXZJdp3qpktb3NJxdkhHhdOdHcsNwnMkk2muhjHoS6zaGlsQ68Q57Y0fTVYdVad\n\tKucA3XVjBNDAQ109uTLOKHYjddvoIKsL/7iDObBAGdabwI2yvjMAFQOHeEr0NkhVMgs\n\tMU02lyC5FTjBMF0cfoWhpxebZwIF8qghNz2/MSzrdW+rUObEUUGgTndW7Y91aEywg2h\n\tE11/33MP0ZewfLQvOiT8fhJPvBF4yYjalUAq2t/ytVaUZOIwxx8ycFkNi9jw+PPBRQq\n\tSxXmvLtSz6WUGO8fQwMfGLzCrqIio7iRlTuDKGwYEq+jWSRaFMsWsEc8PZIjjrZr93H\n\t9F37iGScfQ==",
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;\n\ts=uku4taia5b5tsbglxyj6zym32efj7xqv; d=amazonses.com; t=1726249569;\n\th=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type:Content-Transfer-Encoding:Feedback-ID;\n\tbh=JH5D+nAlVtZPXcWvi8cjEkTpNJjf4VBKppmK/kZY1Dc=;\n\tb=YAdCBSvB2Kt8YMnFJH8XyQ1Ztn3kacfDhkUWgLzxQwJGkw2Dhtt8nRuYiF3+T/W+\n\tQxKhihoycCugOyOKJ5pnfX+cst6Q3uLQZX770psJL6bGWbGdlXJQibh04s3TWi10JI1\n\teWtDFDdD7UG+5jvF1B5uQuEKSPtHEjEPCzgxwZfc="
        ],
        "From": "=?utf-8?q?Cl=C3=A1udio_Paulo?= <claudio.paulo@makewise.pt>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "=?utf-8?q?Cl=C3=A1udio_Paulo?= <claudio.paulo@makewise.pt>",
        "Subject": "[PATCH] libcamera: pipeline: uvcvideo: Retrieve v4l2 device control\n\tinformation",
        "Date": "Fri, 13 Sep 2024 17:46:08 +0000",
        "Message-ID": "<01020191ec7e0ad5-37e0d829-4553-4d41-8063-37af6c08c380-000000@eu-west-1.amazonses.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Feedback-ID": "::1.eu-west-1.z8xjvhxVxUk+kM5mx7i/KMS/a2avhcAXFe/noI67NVQ=:AmazonSES",
        "X-SES-Outgoing": "2024.09.13-54.240.7.20",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Populate frame metadata by using V4L2Device::getControls() to get\nthe values for all supported controls on each frame.\n\nSigned-off-by: Cláudio Paulo <claudio.paulo@makewise.pt>\n---\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 58 ++++++++++++++++++--\n 1 file changed, 54 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 6b32fa18..98a41557 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -333,8 +333,8 @@ int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,\n \n \tcase V4L2_CID_EXPOSURE_AUTO: {\n \t\tint32_t ivalue = value.get<bool>()\n-\t\t\t       ? V4L2_EXPOSURE_APERTURE_PRIORITY\n-\t\t\t       : V4L2_EXPOSURE_MANUAL;\n+\t\t\t\t\t ? V4L2_EXPOSURE_APERTURE_PRIORITY\n+\t\t\t\t\t : V4L2_EXPOSURE_MANUAL;\n \t\tcontrols->set(V4L2_CID_EXPOSURE_AUTO, ivalue);\n \t\tbreak;\n \t}\n@@ -750,10 +750,60 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,\n void UVCCameraData::bufferReady(FrameBuffer *buffer)\n {\n \tRequest *request = buffer->request();\n+\tControlList *metadata = &request->metadata();\n \n \t/* \\todo Use the UVC metadata to calculate a more precise timestamp */\n-\trequest->metadata().set(controls::SensorTimestamp,\n-\t\t\t\tbuffer->metadata().timestamp);\n+\tmetadata->set(controls::SensorTimestamp, buffer->metadata().timestamp);\n+\n+\t/* Retrieve control as reported by the device. */\n+\tstd::vector<uint32_t> ids;\n+\tfor (const auto &ctrl : video_->controls()) {\n+\t\tuint32_t cid = ctrl.first->id();\n+\t\tswitch (cid) {\n+\t\tcase V4L2_CID_BRIGHTNESS:\n+\t\tcase V4L2_CID_CONTRAST:\n+\t\tcase V4L2_CID_SATURATION:\n+\t\tcase V4L2_CID_EXPOSURE_AUTO:\n+\t\tcase V4L2_CID_EXPOSURE_ABSOLUTE:\n+\t\tcase V4L2_CID_GAIN:\n+\t\tcase V4L2_CID_FOCUS_ABSOLUTE:\n+\t\tcase V4L2_CID_FOCUS_AUTO:\n+\t\t\tids.push_back(cid);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tcontinue;\n+\t\t}\n+\t}\n+\n+\tControlList deviceControls = video_->getControls(ids);\n+\tfor (const auto &item : deviceControls) {\n+\t\tswitch (item.first) {\n+\t\tcase V4L2_CID_BRIGHTNESS:\n+\t\t\tmetadata->set(controls::Brightness, item.second.get<float>());\n+\t\t\tbreak;\n+\t\tcase V4L2_CID_CONTRAST:\n+\t\t\tmetadata->set(controls::Contrast, item.second.get<float>());\n+\t\t\tbreak;\n+\t\tcase V4L2_CID_SATURATION:\n+\t\t\tmetadata->set(controls::Saturation, item.second.get<float>());\n+\t\t\tbreak;\n+\t\tcase V4L2_CID_EXPOSURE_AUTO:\n+\t\t\tmetadata->set(controls::AeEnable, item.second.get<bool>());\n+\t\t\tbreak;\n+\t\tcase V4L2_CID_EXPOSURE_ABSOLUTE:\n+\t\t\tmetadata->set(controls::ExposureTime, item.second.get<int>());\n+\t\t\tbreak;\n+\t\tcase V4L2_CID_GAIN:\n+\t\t\tmetadata->set(controls::AnalogueGain, item.second.get<float>());\n+\t\t\tbreak;\n+\t\tcase V4L2_CID_FOCUS_ABSOLUTE:\n+\t\t\tmetadata->set(controls::LensPosition, item.second.get<float>());\n+\t\t\tbreak;\n+\t\tcase V4L2_CID_FOCUS_AUTO:\n+\t\t\tmetadata->set(controls::AfMode, item.second.get<int>());\n+\t\t\tbreak;\n+\t\t}\n+\t}\n \n \tpipe()->completeBuffer(request, buffer);\n \tpipe()->completeRequest(request);\n",
    "prefixes": []
}