From patchwork Fri Sep 4 10:30:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 9492 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id DC3E5BE174 for ; Fri, 4 Sep 2020 10:30:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AE81F629E4; Fri, 4 Sep 2020 12:30:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="r642ngf3"; dkim-atps=neutral Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D09FC628EE for ; Fri, 4 Sep 2020 12:30:48 +0200 (CEST) Received: by mail-wr1-x443.google.com with SMTP id m6so6255821wrn.0 for ; Fri, 04 Sep 2020 03:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2r26cquJvFEGijK6A1Qt2id7HpC8ABt6M/5TpJ40vpQ=; b=r642ngf37LSt1rMNCTHXcsFSgpatXnqpsOPMm8SX5fkVqftbzI/gJ717t3LHd2dg2D XuhRiaUhwVJheVBqLkvOndgXIo6cA4esZGh1HNk4KmVKG3+BTcDVrmiBJYlb1t1DlJzM 3njAh0vOpMcGy1e+Stp3EwAaguUEMKzpfvTNd69G0V70/1BJUZhhFGpMpFeNxC4TDtO4 aH9i3sDtLAJWgMI11d3q+LvFRbiA8c7Fyuu7hZaZQNp6ZkZCPfeTtnlsXQYUEVrdeqBH JgT99GjUB25K5xA7e34cJJteAi7h2Q0JNW6qPJwrlRA5fiFc2d8s2C5YIugkitO0io56 LNYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2r26cquJvFEGijK6A1Qt2id7HpC8ABt6M/5TpJ40vpQ=; b=hd1KrTuZKX56atJsY7Eijf5c1YDPXoz6ikhXh4M2TI40ABeLHu1DR2wW/Yd3g9jAx9 E4NvoTsM+znhCOZx7nibtiUbpcx+wn0v9KddWvnBMgQrNFh9wy3JUBQJzPpCthNNUlRm FqmIs01MCQPy5R1R7UOy0D3ppVkkQfVs8hAsWeGeftLHTHPEPkI/j302JceSCz06u4sf FlzSUfaDO4r15alWSgAzUGTvfre3eNeIXwBRheh0/GddzaY4tRI3cd28cIHg1ybfyNo/ HgUyELe2aG/QLiB/9FjGxP36sJo9rCEj02P5HiOFUJG9EKK9qxWaozIyHOJ+qDRg8T2b OaMQ== X-Gm-Message-State: AOAM533x/Ezh9bcCp0+5ORlNRs3gl8StZpHFUVbuXzWEtXDRod7LZMbB Oh22rrYvxDtmlGX4orFYF9K+7moabaTstw== X-Google-Smtp-Source: ABdhPJyIHihT6aeCPunHX2VKJZJ+iA/ZRY70JdyjUw4Wr7kmw3lNG8AHDIsKhG3jxHfY2rSeuAM0gg== X-Received: by 2002:adf:fa02:: with SMTP id m2mr6898860wrr.273.1599215448275; Fri, 04 Sep 2020 03:30:48 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id q4sm10294542wru.65.2020.09.04.03.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 03:30:47 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Fri, 4 Sep 2020 11:30:36 +0100 Message-Id: <20200904103042.1593-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200904103042.1593-1-david.plowman@raspberrypi.com> References: <20200904103042.1593-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 2/8] libcamera: Allow access to v4l2_query_ext_ctrl structure for a V4L2 control 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The V4L2Device::controlInfo method simply returns a pointer to the v4l2_query_ext_ctrl structure for the given control, which has already been retrieved and stored. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/libcamera/internal/v4l2_device.h | 2 ++ src/libcamera/v4l2_device.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h index 3b605aa..722fb72 100644 --- a/include/libcamera/internal/v4l2_device.h +++ b/include/libcamera/internal/v4l2_device.h @@ -29,6 +29,8 @@ public: ControlList getControls(const std::vector &ids); int setControls(ControlList *ctrls); + const struct v4l2_query_ext_ctrl *controlInfo(uint32_t id) const; + const std::string &deviceNode() const { return deviceNode_; } std::string devicePath() const; diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 65830d4..e8399c4 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -353,6 +353,21 @@ int V4L2Device::setControls(ControlList *ctrls) return ret; } +/** + * \brief Return the v4l2_query_ext_ctrl information for the given control. + * \param[in] id The V4L2 control id + * \return A pointer to the v4l2_query_ext_ctrl structure for the given + * control, or a null pointer if not found + */ +const struct v4l2_query_ext_ctrl *V4L2Device::controlInfo(uint32_t id) const +{ + const auto it = controlInfo_.find(id); + if (it == controlInfo_.end()) + return nullptr; + + return &it->second; +} + /** * \brief Retrieve the device path in sysfs *