{"id":22550,"url":"https://patchwork.libcamera.org/api/patches/22550/?format=json","web_url":"https://patchwork.libcamera.org/patch/22550/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250113215946.1033762-4-paul.elder@ideasonboard.com>","date":"2025-01-13T21:59:37","name":"[v8,03/12] libcamera: uvcvideo: Register ExposureTimeMode control","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"ce79bc06fc70402bb2ab80dad140843cf68f2d4d","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22550/mbox/","series":[{"id":4949,"url":"https://patchwork.libcamera.org/api/series/4949/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4949","date":"2025-01-13T21:59:34","name":"AEGC controls","version":8,"mbox":"https://patchwork.libcamera.org/series/4949/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22550/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22550/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 0587ABD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Jan 2025 22:02:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9E8296854A;\n\tMon, 13 Jan 2025 23:02:14 +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 AA7AB68516\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jan 2025 23:02:10 +0100 (CET)","from pyrite.hamster-moth.ts.net (unknown [173.16.167.215])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CD40C198D;\n\tMon, 13 Jan 2025 23:01: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=\"YPeqZ08T\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1736805674;\n\tbh=B15YFfUVmLnJ+P9l2QCZtmXrmyRX21sG6ITqSkTp5H4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=YPeqZ08TfeeDs1pX82DaINJ/7MadVvwAXuSP015QCKIRQe9sFojiKlyjNrO9HiQvk\n\tEgsU7ODdX3tPME+H+H0bIZlcq5J+jRIZ8uDiB60aqNHmKsP3CjlB1yY6+/130ZzUTm\n\tUiSzHJCewOvoB4rrCS4A6iXgFIdV4ICoKHhBmA4g=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Jacopo Mondi <jacopo@jmondi.org>, laurent.pinchart@ideasonboard.com,\n\tstefan.klug@ideasonboard.com, Paul Elder <paul.elder@ideasonboard.com>","Subject":"[PATCH v8 03/12] libcamera: uvcvideo: Register ExposureTimeMode\n\tcontrol","Date":"Mon, 13 Jan 2025 15:59:37 -0600","Message-Id":"<20250113215946.1033762-4-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.39.2","In-Reply-To":"<20250113215946.1033762-1-paul.elder@ideasonboard.com>","References":"<20250113215946.1033762-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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nNo change in v8\n\nNo change in v7\n\nNo change in v6\n\nChanges in v5:\n- remove unnecessary intermediate variable\n\nNo change in v3\n---\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 53 ++++++++++++++++++--\n 1 file changed, 48 insertions(+), 5 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 8c2c6baf3..7470b5627 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,52 @@ 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\tinfo = ControlInfo{Span<int32_t>{values}, 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":["v8","03/12"]}