Patch Detail
Show a patch.
GET /api/1.1/patches/1501/?format=api
{ "id": 1501, "url": "https://patchwork.libcamera.org/api/1.1/patches/1501/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1501/", "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": "<20190621161401.28337-9-kieran.bingham@ideasonboard.com>", "date": "2019-06-21T16:14:00", "name": "[libcamera-devel,RFC,v2,8/9,PoC] UVCPipelineHandler: Set Controls", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "e06f97f7622733870c80d223034558b3852527d4", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1501/mbox/", "series": [ { "id": 370, "url": "https://patchwork.libcamera.org/api/1.1/series/370/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=370", "date": "2019-06-21T16:13:52", "name": "Libcamera Controls", "version": 2, "mbox": "https://patchwork.libcamera.org/series/370/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1501/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1501/checks/", "tags": {}, "headers": { "Return-Path": "<kieran.bingham@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A8E8F600F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Jun 2019 18:14:08 +0200 (CEST)", "from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4907D52A;\n\tFri, 21 Jun 2019 18:14:08 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561133648;\n\tbh=0wLOUMpJartSM/CFN0lzrHPCTIpwC5tvrXjd1gi13vY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VD2cfcmsZqeFUOoplhHeX6GxE/n49nADOx/4N4uz4ONErpXKhM3rKhnzvuXeOHUzS\n\txNRIFcF7XXFz/sl2UZ8bcMrlnNaE1Eko4ufZvkdXspWmc12RUw0krdqvNLf7eiKtH9\n\tjehG03qnoTtmIUrRRtw/YjSyjvo3WE0p3/hMPpY4=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>", "Date": "Fri, 21 Jun 2019 17:14:00 +0100", "Message-Id": "<20190621161401.28337-9-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190621161401.28337-1-kieran.bingham@ideasonboard.com>", "References": "<20190621161401.28337-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC PATCH v2 8/9] [PoC] UVCPipelineHandler: Set\n\tControls", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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": "Fri, 21 Jun 2019 16:14:09 -0000" }, "content": "Provide an initial sketch of setting controls on the UVC Video Device\nmaking use of the V4L2Control API and interacting with Libcamera\ncontrols.\n\nThis is not intended to be a full implementation, simply an initial\ndemonstration of setting real-world controls from requests.\n\nNot-signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/pipeline/uvcvideo.cpp | 43 ++++++++++++++++++++++++++++-\n 1 file changed, 42 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 2e22523d7cb1..14a2089ea654 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -8,6 +8,7 @@\n #include <algorithm>\n \n #include <libcamera/camera.h>\n+#include <libcamera/controls.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n@@ -16,6 +17,7 @@\n #include \"media_device.h\"\n #include \"pipeline_handler.h\"\n #include \"utils.h\"\n+#include \"v4l2_controls.h\"\n #include \"v4l2_videodevice.h\"\n \n namespace libcamera {\n@@ -71,6 +73,8 @@ public:\n \tbool match(DeviceEnumerator *enumerator) override;\n \n private:\n+\tint processControls(UVCCameraData *data, Request *request);\n+\n \tUVCCameraData *cameraData(const Camera *camera)\n \t{\n \t\treturn static_cast<UVCCameraData *>(\n@@ -216,6 +220,39 @@ void PipelineHandlerUVC::stop(Camera *camera)\n \tPipelineHandler::stop(camera);\n }\n \n+int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request)\n+{\n+\tV4L2Controls controls;\n+\n+\tfor (auto it : request->controls()) {\n+\t\tconst ControlInfo &ci = it.first;\n+\t\tValue &value = it.second;\n+\n+\t\tswitch (ci.id()) {\n+\t\tcase ManualBrightness:\n+\t\t\tLOG(UVC, Debug) << \"Setting Brightness to : \" << value;\n+\t\t\tcontrols.add(V4L2_CID_BRIGHTNESS, value.getInt());\n+\t\t\tbreak;\n+\t\tcase ManualExposure:\n+\t\t\tLOG(UVC, Debug) << \"Setting Exposure to : \" << value;\n+\t\t\tcontrols.add(V4L2_CID_EXPOSURE_AUTO, 1);\n+\t\t\tcontrols.add(V4L2_CID_EXPOSURE_ABSOLUTE, value.getInt());\n+\t\t\tbreak;\n+\t\tcase ManualGain:\n+\t\tdefault:\n+\t\t\tLOG(UVC, Debug) << \"Unsupported control: \"\n+\t\t\t\t\t<< ci.name() << \" : \" << value;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tint ret = data->video_->setControls(&controls);\n+\tif (ret)\n+\t\tLOG(UVC, Error) << \"Failed to set controls\";\n+\n+\treturn ret;\n+}\n+\n int PipelineHandlerUVC::queueRequest(Camera *camera, Request *request)\n {\n \tUVCCameraData *data = cameraData(camera);\n@@ -227,7 +264,11 @@ int PipelineHandlerUVC::queueRequest(Camera *camera, Request *request)\n \t\treturn -ENOENT;\n \t}\n \n-\tint ret = data->video_->queueBuffer(buffer);\n+\tint ret = processControls(data, request);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tret = data->video_->queueBuffer(buffer);\n \tif (ret < 0)\n \t\treturn ret;\n \n", "prefixes": [ "libcamera-devel", "RFC", "v2", "8/9", "PoC" ] }