Show a patch.

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

{
    "id": 15180,
    "url": "https://patchwork.libcamera.org/api/patches/15180/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15180/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20211221043610.2512334-3-paul.elder@ideasonboard.com>",
    "date": "2021-12-21T04:36:04",
    "name": "[libcamera-devel,v3,2/8] libcamera: pipeline: uvcvideo: Support the new AE controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d62d1419758bbc41edc6d45c9b9b458f75348dd9",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/users/17/?format=api",
        "username": "epaul",
        "first_name": "Paul",
        "last_name": "Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/15180/mbox/",
    "series": [
        {
            "id": 2849,
            "url": "https://patchwork.libcamera.org/api/series/2849/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2849",
            "date": "2021-12-21T04:36:02",
            "name": "The Great AE Changes",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2849/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15180/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15180/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 DF0FBBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 21 Dec 2021 04:36:25 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 588A460905;\n\tTue, 21 Dec 2021 05:36:25 +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 EB7756021D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Dec 2021 05:36:21 +0100 (CET)",
            "from pyrite.mediacom.info (unknown\n\t[IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 06489881;\n\tTue, 21 Dec 2021 05:36:20 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"U+E6phbG\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640061381;\n\tbh=fbY+QoPion+Cw2pf5Jk7DtTS9syhd/QPAWaXpuqpB/c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=U+E6phbGRJg/FRulfG+kr9joN3TPbxToGeySvh7/zJpKkDx4u0up6M02AknNoBRfc\n\tbD4EtwPZGOGFr5sIzsBmrAxtsIXEmNqCBP285uBWKnd7+QDW7EFEmo/e+txcfvzd5a\n\tcv/65A8SIMf/10eH2XbIeLG3gA7LvMxTYuNlreSs=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 20 Dec 2021 22:36:04 -0600",
        "Message-Id": "<20211221043610.2512334-3-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20211221043610.2512334-1-paul.elder@ideasonboard.com>",
        "References": "<20211221043610.2512334-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 2/8] libcamera: pipeline: uvcvideo:\n\tSupport the new AE controls",
        "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": "Add support for the new AE controls in the uvcvideo pipeline handler.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=42\nBug: https://bugs.libcamera.org/show_bug.cgi?id=43\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v3:\n- fix the construction of the ControlInfo of enum values\n- fix auto gain in processControl\n- improve auto exposure in processControl\n\nChanges in v2:\n- fix the rebase error where some uvc stuff was in rasberrypi\n---\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 43 +++++++++++++++++---\n 1 file changed, 38 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 40654a0b..ee17add8 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -268,8 +268,10 @@ 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::AnalogueGainMode)\n+\t\tcid = V4L2_CID_AUTOGAIN;\n \telse if (id == controls::ExposureTime)\n \t\tcid = V4L2_CID_EXPOSURE_ABSOLUTE;\n \telse if (id == controls::AnalogueGain)\n@@ -302,13 +304,44 @@ 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\tbool autoGainSet = controls->contains(V4L2_CID_AUTOGAIN);\n+\n+\t\tint32_t ivalue;\n+\t\tif (autoGainSet) {\n+\t\t\tbool autoGain = controls->get(V4L2_CID_AUTOGAIN).get<bool>();\n+\t\t\tivalue = value.get<int32_t>() == controls::ExposureTimeModeAuto\n+\t\t\t       ? (autoGain\n+\t\t\t\t  /* Both exposure time and gain are auto */\n+\t\t\t\t  ? V4L2_EXPOSURE_AUTO\n+\t\t\t\t  /* Exposure time is auto but gain is manual */\n+\t\t\t\t  : V4L2_EXPOSURE_APERTURE_PRIORITY)\n+\t\t\t       : (autoGain\n+\t\t\t\t /* Exposure time is manual but gain is auto */\n+\t\t\t\t ? V4L2_EXPOSURE_SHUTTER_PRIORITY\n+\t\t\t\t /* Both exposure time and gain are manual */\n+\t\t\t\t : V4L2_EXPOSURE_MANUAL);\n+\t\t} else {\n+\t\t\t/*\n+\t\t\t * auto gain is not set, so simply set the auto exposure\n+\t\t\t * mode from what's set in the libcamera control.\n+\t\t\t *\n+\t\t\t * \\todo Figure out how to properly handle priority\n+\t\t\t * when auto exposure is set before auto gain\n+\t\t\t */\n+\t\t\tivalue = value.get<int32_t>() == controls::ExposureTimeModeAuto\n+\t\t\t       ? V4L2_EXPOSURE_AUTO\n \t\t\t       : V4L2_EXPOSURE_MANUAL;\n+\t\t}\n+\n \t\tcontrols->set(V4L2_CID_EXPOSURE_AUTO, ivalue);\n+\n \t\tbreak;\n \t}\n \n+\tcase V4L2_CID_AUTOGAIN:\n+\t\tcontrols->set(V4L2_CID_AUTOGAIN, value.get<bool>());\n+\t\tbreak;\n+\n \tcase V4L2_CID_EXPOSURE_ABSOLUTE:\n \t\tcontrols->set(cid, value.get<int32_t>() / 100);\n \t\tbreak;\n@@ -559,7 +592,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@@ -610,7 +643,7 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,\n \t\tbreak;\n \n \tcase V4L2_CID_EXPOSURE_AUTO:\n-\t\tinfo = ControlInfo{ false, true, true };\n+\t\tinfo = ControlInfo(controls::ExposureTimeModeValues);\n \t\tbreak;\n \n \tcase V4L2_CID_EXPOSURE_ABSOLUTE:\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "2/8"
    ]
}