Patch Detail
Show a patch.
GET /api/patches/1335/?format=api
{ "id": 1335, "url": "https://patchwork.libcamera.org/api/patches/1335/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1335/", "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": "<20190602130435.18780-7-jacopo@jmondi.org>", "date": "2019-06-02T13:04:35", "name": "[libcamera-devel,6/6,HACK] ipu3: Set and get a few sensor controls", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "bec9c3cf891a0f41e6a1601e59b7f9e97526ca22", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/1335/mbox/", "series": [ { "id": 333, "url": "https://patchwork.libcamera.org/api/series/333/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=333", "date": "2019-06-02T13:04:29", "name": "libcamera: v4l2_controls: Add support for V4L2 controls", "version": 1, "mbox": "https://patchwork.libcamera.org/series/333/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1335/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1335/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DB93861905\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 2 Jun 2019 15:03:49 +0200 (CEST)", "from uno.homenet.telecomitalia.it (unknown [79.35.79.123])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 39FBE100003;\n\tSun, 2 Jun 2019 13:03:49 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 2 Jun 2019 15:04:35 +0200", "Message-Id": "<20190602130435.18780-7-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190602130435.18780-1-jacopo@jmondi.org>", "References": "<20190602130435.18780-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 6/6] [HACK] ipu3: Set and get a few sensor\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": "Sun, 02 Jun 2019 13:03:50 -0000" }, "content": "Not to merge patch to demonstrate how to set controls on the image\nsensor device.\n\nNot-Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 86 ++++++++++++++++++++++++++++\n 1 file changed, 86 insertions(+)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 0a50b6159782..7854e5140de8 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -689,6 +689,92 @@ int PipelineHandlerIPU3::start(Camera *camera)\n \tImgUDevice *imgu = data->imgu_;\n \tint ret;\n \n+\t/* --- Get control values --- */\n+\tstd::vector<unsigned int> controlIds = {\n+\t\tV4L2_CID_EXPOSURE, V4L2_CID_ANALOGUE_GAIN,\n+\t};\n+\tstd::vector<V4L2Control *> controls =\n+\t\tcio2->sensor_->dev()->getControls(controlIds);\n+\tif (controls.empty()) {\n+\t\tLOG(Error) << \"Failed to get control values\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (V4L2Control *ctrl : controls) {\n+\t\tunsigned int id = ctrl->id();\n+\n+\t\tswitch(ctrl->type()) {\n+\t\tcase V4L2_CTRL_TYPE_INTEGER:\n+\t\tcase V4L2_CTRL_TYPE_BOOLEAN:\n+\t\t{\n+\t\t\tV4L2IntControl *c = static_cast<V4L2IntControl *>(ctrl);\n+\t\t\tuint32_t val = c->value();\n+\t\t\tLOG(Error) << \"Control : \" << id\n+\t\t\t\t << \" - value: \" << val;\n+\t\t}\n+\t\t\tbreak;\n+\t\tcase V4L2_CTRL_TYPE_INTEGER64:\n+\t\t{\n+\t\t\tV4L2Int64Control *c = static_cast<V4L2Int64Control *>(ctrl);\n+\t\t\tuint64_t val = c->value();\n+\t\t\tLOG(Error) << \"Control : \" << id\n+\t\t\t\t << \" - value: \" << val;\n+\t\t}\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tLOG(Error) << \"Unsupported type: \" << ctrl->type();\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\t/* --- Set control values --- */\n+\tV4L2IntControl exposureControl(V4L2_CID_EXPOSURE, 2046);\n+\tV4L2IntControl gainControl(V4L2_CID_ANALOGUE_GAIN, 1024);\n+\tstd::vector<V4L2Control *> sensorControls = {\n+\t\t&exposureControl, &gainControl,\n+\t};\n+\n+\tret = cio2->sensor_->dev()->setControls(sensorControls);\n+\tif (ret) {\n+\t\tLOG(IPU3, Error) << \"Failed to set controls\";\n+\t\treturn ret;\n+\t}\n+\n+\t/* --- Get control values back again and verify they have changed --- */\n+\tstd::vector<V4L2Control *> newcontrols =\n+\t\tcio2->sensor_->dev()->getControls(controlIds);\n+\tif (newcontrols.empty()) {\n+\t\tLOG(Error) << \"Failed to get control values\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (V4L2Control *ctrl : newcontrols) {\n+\t\tunsigned int id = ctrl->id();\n+\n+\t\tswitch(ctrl->type()) {\n+\t\tcase V4L2_CTRL_TYPE_INTEGER:\n+\t\tcase V4L2_CTRL_TYPE_BOOLEAN:\n+\t\t{\n+\t\t\tV4L2IntControl *c = static_cast<V4L2IntControl *>(ctrl);\n+\t\t\tuint32_t val = c->value();\n+\t\t\tLOG(Error) << \"Control : \" << id\n+\t\t\t\t << \" - value: \" << val;\n+\t\t}\n+\t\t\tbreak;\n+\t\tcase V4L2_CTRL_TYPE_INTEGER64:\n+\t\t{\n+\t\t\tV4L2Int64Control *c = static_cast<V4L2Int64Control *>(ctrl);\n+\t\t\tuint64_t val = c->value();\n+\t\t\tLOG(Error) << \"Control : \" << id\n+\t\t\t\t << \" - value: \" << val;\n+\t\t}\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tLOG(Error) << \"Unsupported type: \" << ctrl->type();\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n \t/*\n \t * Start the ImgU video devices, buffers will be queued to the\n \t * ImgU output and viewfinder when requests will be queued.\n", "prefixes": [ "libcamera-devel", "6/6", "HACK" ] }