{"id":1428,"url":"https://patchwork.libcamera.org/api/patches/1428/?format=json","web_url":"https://patchwork.libcamera.org/patch/1428/","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":"<20190613112046.25260-5-jacopo@jmondi.org>","date":"2019-06-13T11:20:44","name":"[libcamera-devel,v3,4/6] libcamera: camera_sensor: Add V4L2 control operations","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0957144ecd95cc1fff51a71c62b178fdbccdad12","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1428/mbox/","series":[{"id":357,"url":"https://patchwork.libcamera.org/api/series/357/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=357","date":"2019-06-13T11:20:40","name":"Add support for V4L2 Controls","version":3,"mbox":"https://patchwork.libcamera.org/series/357/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1428/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1428/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3149D61BE0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Jun 2019 13:19:44 +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 relay6-d.mail.gandi.net (Postfix) with ESMTPSA id B6889C0014;\n\tThu, 13 Jun 2019 11:19:43 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 13 Jun 2019 13:20:44 +0200","Message-Id":"<20190613112046.25260-5-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190613112046.25260-1-jacopo@jmondi.org>","References":"<20190613112046.25260-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 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, 13 Jun 2019 11:19:45 -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       | 58 +++++++++++++++++++++++++++\n src/libcamera/include/camera_sensor.h |  6 +++\n 2 files changed, 64 insertions(+)","diff":"diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex cb6649efac3f..73e870b6cc98 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -249,6 +249,64 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format)\n \treturn subdev_->setFormat(0, format);\n }\n \n+/**\n+ * \\brief Retrieve the V4L2 control info from the sensor's subdevice\n+ * \\param id The V4L2 control id\n+ *\n+ * Retrieve the V4L2ControlInfo from the V4L2 subdevice backing the\n+ * camera sensor.\n+ *\n+ * More complex camera sensors, which expose multiple subdevices should\n+ * override this method.\n+ *\n+ * \\sa V4L2Device::getControlInfo()\n+ *\n+ * \\return The V4L2ControlInfo associated to the V4L2 control with \\a id or\n+ * nullptr if the control is not supported.\n+ */\n+V4L2ControlInfo *CameraSensor::getControlInfo(unsigned int id)\n+{\n+\treturn subdev_->getControlInfo(id);\n+}\n+\n+/**\n+ * \\brief Read a list of controls from the sensor's subdevice\n+ * \\param ctrls The list of controls to read\n+ *\n+ * Read V4L2 controls values on the V4L2 subdevice backing the\n+ * camera sensor.\n+ *\n+ * More complex camera sensors, which expose multiple subdevices should\n+ * override this method.\n+ *\n+ * \\sa V4L2Device::getControls()\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+int CameraSensor::getControls(V4L2Controls *ctrls)\n+{\n+\treturn subdev_->getControls(ctrls);\n+}\n+\n+/**\n+ * \\brief Write a list of controls from the sensor's subdevice\n+ * \\param ctrls The list of controls to write\n+ *\n+ * Write V4L2 controls values on the V4L2 subdevice backing the\n+ * camera sensor.\n+ *\n+ * More complex camera sensors, which expose multiple subdevices should\n+ * override this method.\n+ *\n+ * \\sa V4L2Device::setControls()\n+ *\n+ * \\return 0 on success or a negative error code otherwise\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..ed6bb16f5686 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+\tV4L2ControlInfo *getControlInfo(unsigned int id);\n+\tint getControls(V4L2Controls *ctrls);\n+\tint setControls(V4L2Controls *ctrls);\n+\n protected:\n \tstd::string logPrefix() const;\n \n","prefixes":["libcamera-devel","v3","4/6"]}