Show a patch.

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

{
    "id": 22958,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/22958/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22958/",
    "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-4-barnabas.pocze@ideasonboard.com>",
    "date": "2025-03-14T17:42:47",
    "name": "[v3,3/4] libcamera: pipeline: uvcvideo: Retrieve current exposure mode on start",
    "commit_ref": null,
    "pull_url": null,
    "state": "deferred",
    "archived": false,
    "hash": "76cebad1015b65759146f787ca42f4a3d3b90d69",
    "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/22958/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/22958/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22958/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 512F7C32F9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Mar 2025 17:42:56 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB01368951;\n\tFri, 14 Mar 2025 18:42:55 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C6866893D\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 E5CD1842\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=\"V0sRLGmL\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1741974073;\n\tbh=8eCneV/+CdU4vWjx2GhnPNxmZoqqI8kdB6VmcYyZu0w=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=V0sRLGmL6XqmQlpqAyL+CiHo1jUiTXJcPP7g9FbR+ZozIPCXlKYtdeu+bZcgpw9dv\n\tzsDpDa+u9olYj8QbHJM2kzm8v394A4m5PVGfK66rxJMEAYuAFKJiuHbWSQOhjNFrO6\n\tj+6agw+l2EgcZDYnx7/VSv/mK+Y7IlM9X1OP7P/g=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v3 3/4] libcamera: pipeline: uvcvideo: Retrieve current\n\texposure mode on start",
        "Date": "Fri, 14 Mar 2025 18:42:47 +0100",
        "Message-ID": "<20250314174248.1015718-4-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": "If `ExposureTimeMode` is supported, then retrieve the current value\nof `V4L2_CID_EXPOSURE_AUTO` in `PipelineHandlerUVC::start()`, and\nconvert it to the appropriate `ExposureTimeModeEnum` value. If it\nis not supported or the conversion fails, then fall back to assuming\nthat `ExposureTimeModeManual` is in effect.\n\nThis is necessary to be able to properly handle the `ExposureTime`\ncontrol as its value is required to be ignored if `ExposureTimeMode`\nis not manual.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 20 ++++++++++++++++++++\n 1 file changed, 20 insertions(+)",
    "diff": "diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 4ff79c291..7d882ebe1 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -62,6 +62,15 @@ public:\n \tstd::optional<v4l2_exposure_auto_type> autoExposureMode_;\n \tstd::optional<v4l2_exposure_auto_type> manualExposureMode_;\n \n+\tstruct State {\n+\t\tstd::optional<controls::ExposureTimeModeEnum> exp;\n+\n+\t\tvoid reset()\n+\t\t{\n+\t\t\texp.reset();\n+\t\t}\n+\t} state_;\n+\n private:\n \tbool generateId();\n \n@@ -303,6 +312,16 @@ int PipelineHandlerUVC::start(Camera *camera, [[maybe_unused]] const ControlList\n \t\treturn ret;\n \t}\n \n+\tif (data->autoExposureMode_ || data->manualExposureMode_) {\n+\t\tconst auto &ctrls = data->video_->getControls({ V4L2_CID_EXPOSURE_AUTO });\n+\t\tconst auto &value = ctrls.get(V4L2_CID_EXPOSURE_AUTO);\n+\t\tif (!value.isNone())\n+\t\t\tdata->state_.exp = v4l2ToExposureMode(value.get<int32_t>());\n+\t}\n+\n+\tif (!data->state_.exp)\n+\t\tdata->state_.exp = controls::ExposureTimeModeManual;\n+\n \treturn 0;\n }\n \n@@ -311,6 +330,7 @@ void PipelineHandlerUVC::stopDevice(Camera *camera)\n \tUVCCameraData *data = cameraData(camera);\n \tdata->video_->streamOff();\n \tdata->video_->releaseBuffers();\n+\tdata->state_.reset();\n }\n \n int PipelineHandlerUVC::processControl(const UVCCameraData *data, ControlList *controls,\n",
    "prefixes": [
        "v3",
        "3/4"
    ]
}