From patchwork Sun Jun 30 23:38:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1544 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2822A61EB4 for ; Mon, 1 Jul 2019 01:38:43 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D60E8255 for ; Mon, 1 Jul 2019 01:38:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1561937923; bh=kQl9YMkR6s3+VJwLhfNpS/6dh2JbNj8gXmx4h01+jVo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=skTiPm5bzZ9+TKSN3Fi51x855pVjMCEVPMRfn5gqQt9PEIBhNWLd/d1jBgYuuKKgK OkLpc9YhF+4gbDMsB4bNqlEOBsaA6/OdkBn9jhDghtNkkeImdaG9fGaEegmgs/g694 tePkxr77s6/Y54XDMxkaRlHz/GGB3jxZlqS0KH3w= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Jul 2019 02:38:05 +0300 Message-Id: <20190630233817.10130-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190630233817.10130-1-laurent.pinchart@ideasonboard.com> References: <20190630233817.10130-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 02/14] libcamera: v4l2_controls: Add min and max to V4L2ControlInfo X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jun 2019 23:38:43 -0000 Add min() and max() methods to V4L2ControlInfo to report the control's minimum and maximum value respectively. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/libcamera/include/v4l2_controls.h | 6 ++++++ src/libcamera/v4l2_controls.cpp | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h index 2c8cb9003f25..0047efab11fa 100644 --- a/src/libcamera/include/v4l2_controls.h +++ b/src/libcamera/include/v4l2_controls.h @@ -28,11 +28,17 @@ public: size_t size() const { return size_; } const std::string &name() const { return name_; } + int64_t min() const { return min_; } + int64_t max() const { return max_; } + private: unsigned int id_; unsigned int type_; size_t size_; std::string name_; + + int64_t min_; + int64_t max_; }; class V4L2Control diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp index 78888de29642..af017bce48ba 100644 --- a/src/libcamera/v4l2_controls.cpp +++ b/src/libcamera/v4l2_controls.cpp @@ -74,6 +74,8 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl) type_ = ctrl.type; name_ = static_cast(ctrl.name); size_ = ctrl.elem_size * ctrl.elems; + min_ = ctrl.minimum; + max_ = ctrl.maximum; } /** @@ -100,6 +102,18 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl) * \return The V4L2 control user readable name */ +/** + * \fn V4L2ControlInfo::min() + * \brief Retrieve the control minimum value + * \return The V4L2 control minimum value + */ + +/** + * \fn V4L2ControlInfo::max() + * \brief Retrieve the control maximum value + * \return The V4L2 control maximum value + */ + /** * \class V4L2Control * \brief A V4L2 control value