Show a patch.

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

{
    "id": 22957,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/22957/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22957/",
    "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": "<20250314174248.1015718-3-barnabas.pocze@ideasonboard.com>",
    "date": "2025-03-14T17:42:46",
    "name": "[v3,2/4] libcamera: pipeline: uvcvideo: Fix `ExposureTimeMode` control setting",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "78e192effe3824b0428f572d9d7ed68b777a2298",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/1.1/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22957/mbox/",
    "series": [
        {
            "id": 5061,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5061/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5061",
            "date": "2025-03-14T17:42:44",
            "name": "libcamera: pipeline: uvcvideo: Fix `ExposureTimeMode` control",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/5061/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22957/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22957/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 34FC8C32F7\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Mar 2025 17:42:55 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ABAA26894D;\n\tFri, 14 Mar 2025 18:42:54 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F0416052C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Mar 2025 18:42:52 +0100 (CET)",
            "from pb-laptop.local (185.221.143.221.nat.pool.zt.hu\n\t[185.221.143.221])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A8119606\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Mar 2025 18:41:12 +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=\"ANKwIXvX\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1741974072;\n\tbh=ls5A5H9AzHH8EShw3Uj+YSMQ4y+43xqaf4XDERlIPZs=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=ANKwIXvXDU+rXSRDjVozxE/aC8MhaAGRIyE7Bxt5OeNkqLF676+qb1VIv2a2bRWJc\n\tNmyGiT33VyF3TxVPvQxlXF2lBb/tHUcNL9t/a3Y+YkrvpyiDSL97b3o1OW0Y/C+K+7\n\tR+5ftCdjD0D/J2HiDOd7ueVZsA6nsksFoj4euMiI=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v3 2/4] libcamera: pipeline: uvcvideo: Fix `ExposureTimeMode`\n\tcontrol setting",
        "Date": "Fri, 14 Mar 2025 18:42:46 +0100",
        "Message-ID": "<20250314174248.1015718-3-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.48.1",
        "In-Reply-To": "<20250314174248.1015718-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20250314174248.1015718-1-barnabas.pocze@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": "The mapping in `UVCCameraData::processControl()` is not entirely correct\nbecause the control value is retrieved as a `bool` instead of `int32_t`.\nAdditionally, the available modes are not taken into account.\n\nRetrieve the control value with the right type, `int32_t`, check if the\nrequested mode is available, and if so, set the appropriate v4l2 control\nvalue selected by `addControl()` earlier.\n\nFixes: bad8d591f8acfa (\"libcamera: uvcvideo: Register ExposureTimeMode control\")\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 29 ++++++++++++++------\n 1 file changed, 20 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 5c9025d9b..4ff79c291 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -99,8 +99,8 @@ public:\n \tbool match(DeviceEnumerator *enumerator) override;\n \n private:\n-\tint processControl(ControlList *controls, unsigned int id,\n-\t\t\t   const ControlValue &value);\n+\tint processControl(const UVCCameraData *data, ControlList *controls,\n+\t\t\t   unsigned int id, const ControlValue &value);\n \tint processControls(UVCCameraData *data, Request *request);\n \n \tbool acquireDevice(Camera *camera) override;\n@@ -313,8 +313,8 @@ void PipelineHandlerUVC::stopDevice(Camera *camera)\n \tdata->video_->releaseBuffers();\n }\n \n-int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,\n-\t\t\t\t       const ControlValue &value)\n+int PipelineHandlerUVC::processControl(const UVCCameraData *data, ControlList *controls,\n+\t\t\t\t       unsigned int id, const ControlValue &value)\n {\n \tuint32_t cid;\n \n@@ -358,10 +358,21 @@ int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,\n \t}\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\tcontrols->set(V4L2_CID_EXPOSURE_AUTO, ivalue);\n+\t\tstd::optional<v4l2_exposure_auto_type> mode;\n+\n+\t\tswitch (value.get<int32_t>()) {\n+\t\tcase controls::ExposureTimeModeAuto:\n+\t\t\tmode = data->autoExposureMode_;\n+\t\t\tbreak;\n+\t\tcase controls::ExposureTimeModeManual:\n+\t\t\tmode = data->manualExposureMode_;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tif (!mode)\n+\t\t\treturn -EINVAL;\n+\n+\t\tcontrols->set(V4L2_CID_EXPOSURE_AUTO, static_cast<int32_t>(*mode));\n \t\tbreak;\n \t}\n \n@@ -399,7 +410,7 @@ int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request)\n \tControlList controls(data->video_->controls());\n \n \tfor (const auto &[id, value] : request->controls())\n-\t\tprocessControl(&controls, id, value);\n+\t\tprocessControl(data, &controls, id, value);\n \n \tfor (const auto &ctrl : controls)\n \t\tLOG(UVC, Debug)\n",
    "prefixes": [
        "v3",
        "2/4"
    ]
}