Show a patch.

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

{
    "id": 21886,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21886/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21886/",
    "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": "<20241113131256.3170817-4-paul.elder@ideasonboard.com>",
    "date": "2024-11-13T13:12:51",
    "name": "[v3,3/8] libcamera: uvcvideo: Register ExposureTimeMode control",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "c76f0074a8742970fc75fafe51f457d80b987e7f",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21886/mbox/",
    "series": [
        {
            "id": 4790,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4790/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4790",
            "date": "2024-11-13T13:12:48",
            "name": "AEGC controls",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/4790/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21886/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21886/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 1B030BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Nov 2024 13:13:28 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BE9EC65823;\n\tWed, 13 Nov 2024 14:13:27 +0100 (CET)",
            "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 3D7E365821\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Nov 2024 14:13:26 +0100 (CET)",
            "from neptunite.flets-east.jp (unknown\n\t[IPv6:2404:7a81:160:2100:eb25:7aa0:7da7:eb24])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EBC771955;\n\tWed, 13 Nov 2024 14:13:10 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"u2LgWaIG\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1731503593;\n\tbh=m7pN2nizjc8W1NbBpo9LOVbZvXTRTW1vruJ29tBNqRE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=u2LgWaIGiMNGzSjitTrByRKOryMLbWlfO4Pi1eXLiP0JwCXQpiEIq7Gvvg+sjFLPV\n\tlC+ZyRah2ZTEljnYEqSZyNmxV7E2ZCQZlyC2zY6NNiLrFt0EZUgWalALwIUcm1kAUT\n\tTnQSVYvL/LyOUPzpHDrxsQ67OuTclN4SnCG84TUk=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "laurent.pinchart@ideasonboard.com, jacopo.mondi@ideasonboard.com,\n\tnaush@raspberrypi.com, david.plowman@raspberrypi.com,\n\tJacopo Mondi <jacopo@jmondi.org>,\n\tPaul Elder <paul.elder@ideasonboard.com>",
        "Subject": "[PATCH v3 3/8] libcamera: uvcvideo: Register ExposureTimeMode\n\tcontrol",
        "Date": "Wed, 13 Nov 2024 22:12:51 +0900",
        "Message-Id": "<20241113131256.3170817-4-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20241113131256.3170817-1-paul.elder@ideasonboard.com>",
        "References": "<20241113131256.3170817-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "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": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nPort the UVC pipeline handler to use the new ExposureTimeMode control\nwhen processing Camera controls in place of the AeEnable control.\n\nThe V4L2_CID_EXPOSURE_AUTO control allows 4 possible values, which\nmap to ExposureTimeModeAuto and ExposureTimeModeManual.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nNo change in v3\n---\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 54 ++++++++++++++++++--\n 1 file changed, 49 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 8c2c6baf3575..a2f0935181d4 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -298,7 +298,7 @@ int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,\n \t\tcid = V4L2_CID_CONTRAST;\n \telse if (id == controls::Saturation)\n \t\tcid = V4L2_CID_SATURATION;\n-\telse if (id == controls::AeEnable)\n+\telse if (id == controls::ExposureTimeMode)\n \t\tcid = V4L2_CID_EXPOSURE_AUTO;\n \telse if (id == controls::ExposureTime)\n \t\tcid = V4L2_CID_EXPOSURE_ABSOLUTE;\n@@ -647,7 +647,7 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,\n \t\tid = &controls::Saturation;\n \t\tbreak;\n \tcase V4L2_CID_EXPOSURE_AUTO:\n-\t\tid = &controls::AeEnable;\n+\t\tid = &controls::ExposureTimeMode;\n \t\tbreak;\n \tcase V4L2_CID_EXPOSURE_ABSOLUTE:\n \t\tid = &controls::ExposureTime;\n@@ -660,6 +660,7 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,\n \t}\n \n \t/* Map the control info. */\n+\tconst std::vector<ControlValue> &v4l2Values = v4l2Info.values();\n \tint32_t min = v4l2Info.min().get<int32_t>();\n \tint32_t max = v4l2Info.max().get<int32_t>();\n \tint32_t def = v4l2Info.def().get<int32_t>();\n@@ -697,10 +698,53 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,\n \t\t};\n \t\tbreak;\n \n-\tcase V4L2_CID_EXPOSURE_AUTO:\n-\t\tinfo = ControlInfo{ false, true, true };\n+\tcase V4L2_CID_EXPOSURE_AUTO: {\n+\t\t/*\n+\t\t * From the V4L2_CID_EXPOSURE_AUTO documentation:\n+\t\t *\n+\t\t * ------------------------------------------------------------\n+\t\t * V4L2_EXPOSURE_AUTO:\n+\t\t * Automatic exposure time, automatic iris aperture.\n+\t\t *\n+\t\t * V4L2_EXPOSURE_MANUAL:\n+\t\t * Manual exposure time, manual iris.\n+\t\t *\n+\t\t * V4L2_EXPOSURE_SHUTTER_PRIORITY:\n+\t\t * Manual exposure time, auto iris.\n+\t\t *\n+\t\t * V4L2_EXPOSURE_APERTURE_PRIORITY:\n+\t\t * Auto exposure time, manual iris.\n+\t\t *-------------------------------------------------------------\n+\t\t *\n+\t\t * ExposureTimeModeAuto = { V4L2_EXPOSURE_AUTO,\n+\t\t * \t\t\t    V4L2_EXPOSURE_APERTURE_PRIORITY }\n+\t\t *\n+\t\t *\n+\t\t * ExposureTimeModeManual = { V4L2_EXPOSURE_MANUAL,\n+\t\t *\t\t\t      V4L2_EXPOSURE_SHUTTER_PRIORITY }\n+\t\t */\n+\t\tstd::array<int32_t, 2> values{};\n+\n+\t\tauto it = std::find_if(v4l2Values.begin(), v4l2Values.end(),\n+\t\t\t[&](const ControlValue &val) {\n+\t\t\t\treturn (val.get<int32_t>() == V4L2_EXPOSURE_APERTURE_PRIORITY ||\n+\t\t\t\t\tval.get<int32_t>() == V4L2_EXPOSURE_AUTO) ? true : false;\n+\t\t\t});\n+\t\tif (it != v4l2Values.end())\n+\t\t\tvalues.back() = static_cast<int32_t>(controls::ExposureTimeModeAuto);\n+\n+\t\tit = std::find_if(v4l2Values.begin(), v4l2Values.end(),\n+\t\t\t[&](const ControlValue &val) {\n+\t\t\t\treturn (val.get<int32_t>() == V4L2_EXPOSURE_SHUTTER_PRIORITY ||\n+\t\t\t\t\tval.get<int32_t>() == V4L2_EXPOSURE_MANUAL) ? true : false;\n+\t\t\t});\n+\t\tif (it != v4l2Values.end())\n+\t\t\tvalues.back() = static_cast<int32_t>(controls::ExposureTimeModeManual);\n+\n+\t\tint32_t *data = values.data();\n+\t\tinfo = ControlInfo{Span<int32_t>(data, 2), values[0]};\n \t\tbreak;\n-\n+\t}\n \tcase V4L2_CID_EXPOSURE_ABSOLUTE:\n \t\t/*\n \t\t * ExposureTime is in units of 1 µs, and UVC expects\n",
    "prefixes": [
        "v3",
        "3/8"
    ]
}