Show a patch.

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

{
    "id": 17078,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17078/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17078/",
    "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": "<20220811150219.62066-3-jacopo@jmondi.org>",
    "date": "2022-08-11T15:02:15",
    "name": "[libcamera-devel,v2,2/6] libcamera: uvcvideo: Register ExposureTimeMode control",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "c76f0074a8742970fc75fafe51f457d80b987e7f",
    "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/17078/mbox/",
    "series": [
        {
            "id": 3404,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3404/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3404",
            "date": "2022-08-11T15:02:13",
            "name": "AEGC controls",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3404/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17078/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17078/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 26D7CBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Aug 2022 15:02:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D7B0263332;\n\tThu, 11 Aug 2022 17:02:37 +0200 (CEST)",
            "from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4602C63327\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Aug 2022 17:02:36 +0200 (CEST)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id EE6151BF205;\n\tThu, 11 Aug 2022 15:02:34 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660230157;\n\tbh=KzJ0/tq9QCpf6bmGfhk/V4Tbdp+Mebx49XIlXRkGLbQ=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=EyqiP4+9qy0+NRw6GQPMTsC/5VA3XFB9Qbz6ZTTvpki2/5w8YUVezd1Fzz59qvh8H\n\tpao5zfVDqLGBzkCADqL/BJ/+G+Gy+K5I74/G3ZngLLoje71TpcaepBfvif/f82CRAV\n\tIYPbyg2fAf2G2dhSPMQZE9bhDgotgzEZSYELKN7T7kAF1Jl9CjGcSx35BrNehLzcWn\n\tvQNyJ28IlDn2WKo8VuNUg9opGEXq1YUAx+rfeSZR51MJ22eWQF3ZbzLU/j3SzFmvBU\n\t4VRozg2xqoUBQlum8tfJpnPGWzImfaNkWz+OnllH+XjTZwLmcqsnjvXMf8Ngu0nE5q\n\tScOZT3ZinkgWA==",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 11 Aug 2022 17:02:15 +0200",
        "Message-Id": "<20220811150219.62066-3-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.37.1",
        "In-Reply-To": "<20220811150219.62066-1-jacopo@jmondi.org>",
        "References": "<20220811150219.62066-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 2/6] libcamera: uvcvideo: Register\n\tExposureTimeMode control",
        "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>",
        "From": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Port 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>\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 fbe02cdcd520..08a37da0d90d 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -266,7 +266,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@@ -580,7 +580,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@@ -593,6 +593,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@@ -630,10 +631,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": [
        "libcamera-devel",
        "v2",
        "2/6"
    ]
}