[{"id":32320,"web_url":"https://patchwork.libcamera.org/comment/32320/","msgid":"<20241121032119.GC12409@pendragon.ideasonboard.com>","date":"2024-11-21T03:21:19","subject":"Re: [PATCH v3 3/8] libcamera: uvcvideo: Register ExposureTimeMode\n\tcontrol","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul, Jacopo,\n\nThank you for the patch.\n\nOn Wed, Nov 13, 2024 at 10:12:51PM +0900, Paul Elder wrote:\n> From: Jacopo Mondi <jacopo@jmondi.org>\n> \n> Port the UVC pipeline handler to use the new ExposureTimeMode control\n> when processing Camera controls in place of the AeEnable control.\n> \n> The V4L2_CID_EXPOSURE_AUTO control allows 4 possible values, which\n> map to ExposureTimeModeAuto and ExposureTimeModeManual.\n\nShould we fix https://bugs.libcamera.org/show_bug.cgi?id=242 while at it\n?\n\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> ---\n> No change in v3\n> ---\n>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 54 ++++++++++++++++++--\n>  1 file changed, 49 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> index 8c2c6baf3575..a2f0935181d4 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,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","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 6E619C32F9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Nov 2024 03:21:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 58FB965F9D;\n\tThu, 21 Nov 2024 04:21:30 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EC3E865F54\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Nov 2024 04:21:28 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0ACDB219;\n\tThu, 21 Nov 2024 04:21:09 +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=\"JTzSpSWR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1732159270;\n\tbh=o+HYr4PaUC7sRq/2mGWv/YqwqKdcgUN7o5OZ6eTC0BI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=JTzSpSWRazjoNHfN8a5McO1z6rKM5Se37rnWGZig61WbbjLbe3n1fjCTvgye3yqvI\n\ttZJM8lCpUdKS9o/lWR96WdOiKpGy1+lu22HEjYmc4BlaTUswAXs9smEkLcTPx0yAo4\n\tEeJd5BXYDVZkP9HUGWKkM/p7ZBCK58KyUTzkPJyI=","Date":"Thu, 21 Nov 2024 05:21:19 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, jacopo.mondi@ideasonboard.com,\n\tnaush@raspberrypi.com, david.plowman@raspberrypi.com,\n\tJacopo Mondi <jacopo@jmondi.org>","Subject":"Re: [PATCH v3 3/8] libcamera: uvcvideo: Register ExposureTimeMode\n\tcontrol","Message-ID":"<20241121032119.GC12409@pendragon.ideasonboard.com>","References":"<20241113131256.3170817-1-paul.elder@ideasonboard.com>\n\t<20241113131256.3170817-4-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20241113131256.3170817-4-paul.elder@ideasonboard.com>","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>"}},{"id":32493,"web_url":"https://patchwork.libcamera.org/comment/32493/","msgid":"<Z07jfOYjtJHf6cnp@pyrite.rasen.tech>","date":"2024-12-03T10:54:52","subject":"Re: [PATCH v3 3/8] libcamera: uvcvideo: Register ExposureTimeMode\n\tcontrol","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Thu, Nov 21, 2024 at 05:21:19AM +0200, Laurent Pinchart wrote:\n> Hi Paul, Jacopo,\n> \n> Thank you for the patch.\n> \n> On Wed, Nov 13, 2024 at 10:12:51PM +0900, Paul Elder wrote:\n> > From: Jacopo Mondi <jacopo@jmondi.org>\n> > \n> > Port the UVC pipeline handler to use the new ExposureTimeMode control\n> > when processing Camera controls in place of the AeEnable control.\n> > \n> > The V4L2_CID_EXPOSURE_AUTO control allows 4 possible values, which\n> > map to ExposureTimeModeAuto and ExposureTimeModeManual.\n> \n> Should we fix https://bugs.libcamera.org/show_bug.cgi?id=242 while at it\n> ?\n\nI'd rather do it on top than delay this even further.\n\n\nPaul\n\n> \n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> > \n> > ---\n> > No change in v3\n> > ---\n> >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 54 ++++++++++++++++++--\n> >  1 file changed, 49 insertions(+), 5 deletions(-)\n> > \n> > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > index 8c2c6baf3575..a2f0935181d4 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,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> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 8F60BBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  3 Dec 2024 10:55:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9E67B66083;\n\tTue,  3 Dec 2024 11:55:03 +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 9926666072\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  3 Dec 2024 11:55:01 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:f145:8e6b:1fcd:b64a])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4AB79E1;\n\tTue,  3 Dec 2024 11:54:32 +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=\"VWwgRa7M\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733223274;\n\tbh=+UbBh1qcnT185qEVDFpXQznm6t+vGAEL9flcEX4OPkM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=VWwgRa7M0OoB6u0i4GJfS0XBaasDjjPnlPWbCJ56oiOcVz/I7hpezO1f+ZxozrCqo\n\tueTFGXU0O0s9mVGLdLYILBPHNz5afcfitMXdeuAnYxN1IXCko+ivRV5iBoqlZgCfzO\n\tQJ8iOa8Ni4DziHasjDK4EaV4DAxcBGMtFMi5FSGM=","Date":"Tue, 3 Dec 2024 19:54:52 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, jacopo.mondi@ideasonboard.com,\n\tnaush@raspberrypi.com, david.plowman@raspberrypi.com,\n\tJacopo Mondi <jacopo@jmondi.org>","Subject":"Re: [PATCH v3 3/8] libcamera: uvcvideo: Register ExposureTimeMode\n\tcontrol","Message-ID":"<Z07jfOYjtJHf6cnp@pyrite.rasen.tech>","References":"<20241113131256.3170817-1-paul.elder@ideasonboard.com>\n\t<20241113131256.3170817-4-paul.elder@ideasonboard.com>\n\t<20241121032119.GC12409@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20241121032119.GC12409@pendragon.ideasonboard.com>","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>"}},{"id":32494,"web_url":"https://patchwork.libcamera.org/comment/32494/","msgid":"<20241203105932.GP10736@pendragon.ideasonboard.com>","date":"2024-12-03T10:59:32","subject":"Re: [PATCH v3 3/8] libcamera: uvcvideo: Register ExposureTimeMode\n\tcontrol","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Dec 03, 2024 at 07:54:52PM +0900, Paul Elder wrote:\n> On Thu, Nov 21, 2024 at 05:21:19AM +0200, Laurent Pinchart wrote:\n> > On Wed, Nov 13, 2024 at 10:12:51PM +0900, Paul Elder wrote:\n> > > From: Jacopo Mondi <jacopo@jmondi.org>\n> > > \n> > > Port the UVC pipeline handler to use the new ExposureTimeMode control\n> > > when processing Camera controls in place of the AeEnable control.\n> > > \n> > > The V4L2_CID_EXPOSURE_AUTO control allows 4 possible values, which\n> > > map to ExposureTimeModeAuto and ExposureTimeModeManual.\n> > \n> > Should we fix https://bugs.libcamera.org/show_bug.cgi?id=242 while at it\n> > ?\n> \n> I'd rather do it on top than delay this even further.\n\nI was thinking that fixing the issue would be useful to show that the\nAPI can work for this use case. I'm fine with a separate patch on top,\nmaybe you could first send v4 of this series and then fix the UVC issue\nwhile I review the new version ?\n\n> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> > > \n> > > ---\n> > > No change in v3\n> > > ---\n> > >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 54 ++++++++++++++++++--\n> > >  1 file changed, 49 insertions(+), 5 deletions(-)\n> > > \n> > > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > > index 8c2c6baf3575..a2f0935181d4 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,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> > \n> > -- \n> > Regards,\n> > \n> > Laurent Pinchart","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 CED99BDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  3 Dec 2024 10:59:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B38D96608C;\n\tTue,  3 Dec 2024 11:59:46 +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 77E1C66081\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  3 Dec 2024 11:59:44 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C08EDE1;\n\tTue,  3 Dec 2024 11:59:16 +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=\"AadM0lGL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733223557;\n\tbh=QIWlCKTIzmONgrXMc4J1ZYemdrQbd8Uhub31vpbghRk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=AadM0lGLpu55NH015Vh1ys2dVBMkbjX9wX2IZjgpRQL/yLB0XPGhYedihKNuq/cij\n\tP2P4uobM3G1G5VRveIqgEbu1qA2tjj4FGzfgrBvnsuuIOU4qLAIxDQEafS6EgWuedl\n\t59MRtyFY0fIk/PI02MHfrvq0cUVKypkD8pYs8PpQ=","Date":"Tue, 3 Dec 2024 12:59:32 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, jacopo.mondi@ideasonboard.com,\n\tnaush@raspberrypi.com, david.plowman@raspberrypi.com,\n\tJacopo Mondi <jacopo@jmondi.org>","Subject":"Re: [PATCH v3 3/8] libcamera: uvcvideo: Register ExposureTimeMode\n\tcontrol","Message-ID":"<20241203105932.GP10736@pendragon.ideasonboard.com>","References":"<20241113131256.3170817-1-paul.elder@ideasonboard.com>\n\t<20241113131256.3170817-4-paul.elder@ideasonboard.com>\n\t<20241121032119.GC12409@pendragon.ideasonboard.com>\n\t<Z07jfOYjtJHf6cnp@pyrite.rasen.tech>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<Z07jfOYjtJHf6cnp@pyrite.rasen.tech>","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>"}}]