From patchwork Sun Oct 13 23:27:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2183 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5464361563 for ; Mon, 14 Oct 2019 01:28:03 +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 CA6DA80B for ; Mon, 14 Oct 2019 01:28:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1571009282; bh=NCqyGMry2g4r6rw9Pzmv/oLQwsqOyF7thxVr+RN9MZ0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=c1YE8cWzdjJkFmeTEILvHSSYadLIyM26f1c+0hE2EEsfs74uZ9xPomgEsiizeo/cC epj5TzaSJSXOwMsmVQ51u542Or8LofkDUiqqRofQhIQCm9CuoepLonU2D6jJu8oOmB svxw0eNVp/0d2a6FCIOQ3it5OQI9odjzdZrTNFt8= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 14 Oct 2019 02:27:47 +0300 Message-Id: <20191013232755.3292-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191013232755.3292-1-laurent.pinchart@ideasonboard.com> References: <20191013232755.3292-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 01/10] libcamera: v4l2_controls: Remove V4L2ControlInfo::size() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 23:28:03 -0000 We don't support V4L2 compound controls, the size field is thus unused. Remove it to ease merging of the libcamera and V4L2 control info classes. Support for array controls can then be added later on top, and would be useful for libcamera controls too. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/libcamera/include/v4l2_controls.h | 4 ---- src/libcamera/v4l2_controls.cpp | 8 -------- src/libcamera/v4l2_device.cpp | 14 ++++++++++++-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h index 89cc74485e6f..133f5262febf 100644 --- a/src/libcamera/include/v4l2_controls.h +++ b/src/libcamera/include/v4l2_controls.h @@ -31,14 +31,10 @@ public: V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl); const ControlId &id() const { return id_; } - size_t size() const { return size_; } - const ControlRange &range() const { return range_; } private: V4L2ControlId id_; - size_t size_; - ControlRange range_; }; diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp index c45d3fda2e1f..dcf31b7a8f26 100644 --- a/src/libcamera/v4l2_controls.cpp +++ b/src/libcamera/v4l2_controls.cpp @@ -127,8 +127,6 @@ V4L2ControlId::V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl) V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl) : id_(ctrl) { - size_ = ctrl.elem_size * ctrl.elems; - if (ctrl.type == V4L2_CTRL_TYPE_INTEGER64) range_ = ControlRange(static_cast(ctrl.minimum), static_cast(ctrl.maximum)); @@ -143,12 +141,6 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl) * \return The V4L2 control ID */ -/** - * \fn V4L2ControlInfo::size() - * \brief Retrieve the control value data size (in bytes) - * \return The V4L2 control value data size - */ - /** * \fn V4L2ControlInfo::range() * \brief Retrieve the control value range diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index b47ba448f354..54cc214ecce9 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -8,11 +8,13 @@ #include "v4l2_device.h" #include +#include #include #include #include #include "log.h" +#include "utils.h" #include "v4l2_controls.h" /** @@ -360,6 +362,13 @@ void V4L2Device::listControls() ctrl.flags & V4L2_CTRL_FLAG_DISABLED) continue; + if (ctrl.elems != 1 || ctrl.nr_of_dims) { + LOG(V4L2, Debug) + << "Array control " << utils::hex(ctrl.id) + << " not supported"; + continue; + } + switch (ctrl.type) { case V4L2_CTRL_TYPE_INTEGER: case V4L2_CTRL_TYPE_BOOLEAN: @@ -371,8 +380,9 @@ void V4L2Device::listControls() break; /* \todo Support compound controls. */ default: - LOG(V4L2, Debug) << "Control type '" << ctrl.type - << "' not supported"; + LOG(V4L2, Debug) + << "Control " << utils::hex(ctrl.id) + << " has unsupported type " << ctrl.type; continue; }