[{"id":1954,"web_url":"https://patchwork.libcamera.org/comment/1954/","msgid":"<20190619205746.GO21753@pendragon.ideasonboard.com>","date":"2019-06-19T20:57:46","subject":"Re: [libcamera-devel] [PATCH v4 4/6] libcamera: camera_sensor: Add\n\tV4L2 control operations","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Jun 19, 2019 at 01:08:56PM +0200, Jacopo Mondi wrote:\n> Add operations to get and set control and to retrieve the informations\n> on a V4L2 control. For simple camera sensors, the operations are\n> directly called on the underlying V4L2 subdevice.\n\nThis makes CameraSensor V4L2-specific, but I think that's fair for now.\n\n> Signed-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(+)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index a804a68c9d91..28a32a96ef7b 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -247,6 +247,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\ns/control id/control ID/\n\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\nThen you'll have to declare it as virtual. For now let's not bother, you\ncan drop this sentence. Same for the two methods below.\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\nCould you update the documentation for those three functions similarly\nto how you'll update V4L2Device after my review ?\n\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() + \"'\";\n> diff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\n> index 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\n\tconst V4L2ControlInfo *getControlInfo(unsigned int id) const;\n\n> +\tint getControls(V4L2Controls *ctrls);\n> +\tint setControls(V4L2Controls *ctrls);\n> +\n>  protected:\n>  \tstd::string logPrefix() const;\n>","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 0B04C60BC5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jun 2019 22:58:05 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 66F02333;\n\tWed, 19 Jun 2019 22:58:04 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1560977884;\n\tbh=TMhyrf5gsvoGtiCYcNvjQbEBUrR0JKAj+NEthjELEbg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kj9FOaMj4l7CKfgzAtOnyBvc+R1pod5eLaAq4HJkWXkVdlz2nWp8pcCCF+fTVJwcp\n\tzuFAZsd+y22+Og9kBPR5OK7hmtzagUi3IoT5hwYZJIKiC0o4NUaKD47rvBFZKqWloQ\n\tEZ8aRf6Y5Ivz72AJaW3D4Wc4r0JYjVIuXzoYe9eY=","Date":"Wed, 19 Jun 2019 23:57:46 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190619205746.GO21753@pendragon.ideasonboard.com>","References":"<20190619110858.20980-1-jacopo@jmondi.org>\n\t<20190619110858.20980-5-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190619110858.20980-5-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v4 4/6] libcamera: camera_sensor: Add\n\tV4L2 control 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":"Wed, 19 Jun 2019 20:58:05 -0000"}}]