Patch Detail
Show a patch.
GET /api/patches/1487/?format=api
{ "id": 1487, "url": "https://patchwork.libcamera.org/api/patches/1487/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1487/", "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": "<20190620153144.5394-5-jacopo@jmondi.org>", "date": "2019-06-20T15:31:42", "name": "[libcamera-devel,v5,4/6] libcamera: camera_sensor: Add V4L2 control operations", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "706130ea10f72346432423836d583039087f0a98", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1487/mbox/", "series": [ { "id": 368, "url": "https://patchwork.libcamera.org/api/series/368/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=368", "date": "2019-06-20T15:31:38", "name": "Add support for V4L2 controls", "version": 5, "mbox": "https://patchwork.libcamera.org/series/368/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1487/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1487/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D7E7060BA1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 20 Jun 2019 17:30:42 +0200 (CEST)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 5C4A2240005;\n\tThu, 20 Jun 2019 15:30:42 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 20 Jun 2019 17:31:42 +0200", "Message-Id": "<20190620153144.5394-5-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190620153144.5394-1-jacopo@jmondi.org>", "References": "<20190620153144.5394-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 4/6] libcamera: camera_sensor: Add V4L2\n\tcontrol operations", "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": "Thu, 20 Jun 2019 15:30:43 -0000" }, "content": "Add operations to get and set control and to retrieve the informations\non a V4L2 control. For simple camera sensors, the operations are\ndirectly called on the underlying V4L2 subdevice.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/camera_sensor.cpp | 65 +++++++++++++++++++++++++++\n src/libcamera/include/camera_sensor.h | 6 +++\n 2 files changed, 71 insertions(+)", "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex a804a68c9d91..637f86b05701 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -247,6 +247,71 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format)\n \treturn subdev_->setFormat(0, format);\n }\n \n+/**\n+ * \\brief Retrieve information about a control\n+ * \\param[in] id The control ID\n+ * \\return A pointer to the V4L2ControlInfo for control \\a id, or nullptr\n+ * if the sensor doesn't have such a control\n+ */\n+const V4L2ControlInfo *CameraSensor::getControlInfo(unsigned int id) const\n+{\n+\treturn subdev_->getControlInfo(id);\n+}\n+\n+/**\n+ * \\brief Read controls from the sensor\n+ * \\param[inout] ctrls The list of controls to read\n+ *\n+ * Read the value of each control contained in \\a ctrls, and store the\n+ * value in the corresponding \\a ctrls entry.\n+ *\n+ * If an integer number less than the requested number of controls is returned,\n+ * only controls up to that index have been successfully read.\n+ *\n+ * Each V4L2Control instance in \\a ctrls should be supported by the sensor and\n+ * accessible (ie the V4L2_CTRL_FLAG_DISABLED flag should not be set), otherwise\n+ * a negative error code (-EINVAL) is returned\n+ *\n+ * \\sa V4L2Device::getControls()\n+ *\n+ * \\return 0 on success or an error code otherwise\n+ * \\retval -EINVAL One of the control is not supported or not accessible\n+ * \\retval i The index of the control that failed\n+ */\n+int CameraSensor::getControls(V4L2Controls *ctrls)\n+{\n+\treturn subdev_->getControls(ctrls);\n+}\n+\n+/**\n+ * \\brief Write controls to the sensor\n+ * \\param[in] ctrls The list of controls to write\n+ *\n+ * Write the value of each V4L2Control contained in \\a ctrls. Each\n+ * control should be initialized by the caller with a value, otherwise\n+ * the result of the operation is undefined.\n+ *\n+ * The value of each control is updated to reflect what has been\n+ * actually applied on the sensor.\n+ *\n+ * If an integer number less than the requested number of controls is returned,\n+ * only controls up to that index have been successfully applied.\n+ *\n+ * Each V4L2Control instance in \\a ctrls should be supported by the sensor and\n+ * accessible (ie the V4L2_CTRL_FLAG_DISABLED flag should not be set), otherwise\n+ * a negative error code (-EINVAL) is returned\n+ *\n+ * \\sa V4L2Device::setControls()\n+ *\n+ * \\return 0 on success or an error code otherwise\n+ * \\retval -EINVAL One of the control is not supported or not accessible\n+ * \\retval i The index of the control that failed\n+ */\n+int CameraSensor::setControls(V4L2Controls *ctrls)\n+{\n+\treturn subdev_->setControls(ctrls);\n+}\n+\n std::string CameraSensor::logPrefix() const\n {\n \treturn \"'\" + subdev_->entity()->name() + \"'\";\ndiff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\nindex b823480241a7..b4f4b66e96c4 100644\n--- a/src/libcamera/include/camera_sensor.h\n+++ b/src/libcamera/include/camera_sensor.h\n@@ -17,6 +17,8 @@\n namespace libcamera {\n \n class MediaEntity;\n+class V4L2ControlInfo;\n+class V4L2Controls;\n class V4L2Subdevice;\n \n struct V4L2SubdeviceFormat;\n@@ -41,6 +43,10 @@ public:\n \t\t\t\t const Size &size) const;\n \tint setFormat(V4L2SubdeviceFormat *format);\n \n+\tconst V4L2ControlInfo *getControlInfo(unsigned int id) const;\n+\tint getControls(V4L2Controls *ctrls);\n+\tint setControls(V4L2Controls *ctrls);\n+\n protected:\n \tstd::string logPrefix() const;\n \n", "prefixes": [ "libcamera-devel", "v5", "4/6" ] }