{"id":3536,"url":"https://patchwork.libcamera.org/api/patches/3536/?format=json","web_url":"https://patchwork.libcamera.org/patch/3536/","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":"<20200425004533.26907-3-laurent.pinchart@ideasonboard.com>","date":"2020-04-25T00:45:28","name":"[libcamera-devel,v5,2/7] libcamera: pipeline: uvcvideo: Add support for AeEnable","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"33b1c7347c601dd13148a0b5dbeeee7c73ba5a38","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3536/mbox/","series":[{"id":824,"url":"https://patchwork.libcamera.org/api/series/824/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=824","date":"2020-04-25T00:45:26","name":"Patchset for libcamera controls","version":5,"mbox":"https://patchwork.libcamera.org/series/824/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3536/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3536/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 EB24162E67\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 25 Apr 2020 02:45:52 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 79446A4F;\n\tSat, 25 Apr 2020 02:45:52 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"tvC8980u\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1587775552;\n\tbh=avs0w/guuptuEhMqpbQSNR1GngWJj0G0drhYY+7n9YE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=tvC8980uGqdYvkcdnxbGNS5KNsRlpU6jRC+OrXPltlOsU7ColaY5PNC7Hp6/6/4NE\n\t5Iuf4NvBFhLMIPsjLfZS6P9JdBNAjelkVtOMB4kEEF2qjRPBKNkn5SZMTiKNnIiyV2\n\tqoSLFeyxQBQXDSI5Nu8zEImguFohTCh7Rhm7esE8=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 25 Apr 2020 03:45:28 +0300","Message-Id":"<20200425004533.26907-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.25.3","In-Reply-To":"<20200425004533.26907-1-laurent.pinchart@ideasonboard.com>","References":"<20200425004533.26907-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 2/7] libcamera: pipeline: uvcvideo: Add\n\tsupport for AeEnable","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>","X-List-Received-Date":"Sat, 25 Apr 2020 00:45:53 -0000"},"content":"UVC devices support auto-exposure, expose the feature through the\nAeEnable control.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 42 +++++++++++++++-----\n 1 file changed, 33 insertions(+), 9 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 92777b9f5fe4..b040f2460b1c 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -244,9 +244,6 @@ void PipelineHandlerUVC::stop(Camera *camera)\n int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,\n \t\t\t\t       const ControlValue &value)\n {\n-\tif (value.type() != ControlTypeInteger32)\n-\t\treturn -EINVAL;\n-\n \tuint32_t cid;\n \n \tif (id == controls::Brightness)\n@@ -255,6 +252,8 @@ 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+\t\tcid = V4L2_CID_EXPOSURE_AUTO;\n \telse if (id == controls::ManualExposure)\n \t\tcid = V4L2_CID_EXPOSURE_ABSOLUTE;\n \telse if (id == controls::ManualGain)\n@@ -262,12 +261,21 @@ int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,\n \telse\n \t\treturn -EINVAL;\n \n-\tint32_t ivalue = value.get<int32_t>();\n+\tswitch (cid) {\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\tbreak;\n+\t}\n \n-\tif (cid == V4L2_CID_EXPOSURE_ABSOLUTE)\n-\t\tcontrols->set(V4L2_CID_EXPOSURE_AUTO, static_cast<int32_t>(1));\n-\n-\tcontrols->set(cid, ivalue);\n+\tdefault: {\n+\t\tint32_t ivalue = value.get<int32_t>();\n+\t\tcontrols->set(cid, ivalue);\n+\t\tbreak;\n+\t}\n+\t}\n \n \treturn 0;\n }\n@@ -388,7 +396,9 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,\n \t\t\t       ControlInfoMap::Map *ctrls)\n {\n \tconst ControlId *id;\n+\tControlInfo info;\n \n+\t/* Map the control ID. */\n \tswitch (cid) {\n \tcase V4L2_CID_BRIGHTNESS:\n \t\tid = &controls::Brightness;\n@@ -399,6 +409,9 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,\n \tcase V4L2_CID_SATURATION:\n \t\tid = &controls::Saturation;\n \t\tbreak;\n+\tcase V4L2_CID_EXPOSURE_AUTO:\n+\t\tid = &controls::AeEnable;\n+\t\tbreak;\n \tcase V4L2_CID_EXPOSURE_ABSOLUTE:\n \t\tid = &controls::ManualExposure;\n \t\tbreak;\n@@ -409,7 +422,18 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,\n \t\treturn;\n \t}\n \n-\tctrls->emplace(id, v4l2Info);\n+\t/* Map the control info. */\n+\tswitch (cid) {\n+\tcase V4L2_CID_EXPOSURE_AUTO:\n+\t\tinfo = ControlInfo{ false, true, true };\n+\t\tbreak;\n+\n+\tdefault:\n+\t\tinfo = v4l2Info;\n+\t\tbreak;\n+\t}\n+\n+\tctrls->emplace(id, info);\n }\n \n void UVCCameraData::bufferReady(FrameBuffer *buffer)\n","prefixes":["libcamera-devel","v5","2/7"]}