From patchwork Fri Mar 13 23:38:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3089 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D0A5262938 for ; Sat, 14 Mar 2020 00:39:07 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 323EC184A; Sat, 14 Mar 2020 00:39:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1584142747; bh=LrsspT9ELByFH4FEUA+hZP9TBMIXM+ke8hkA1+XUzkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e6nDDcJVV1UIgTxlB0A4G+lZ6R5w7vI2+bKSKG5eXtdwf9on2glM6r5j6nqHtlefu Du/5I5SCd+iuqfIetbSvBHH23hfqnW5U+UK1ROKEcXfe6ILsG8A525Bp8vqwb1UUIp /fNIIyACI+93lXB+hJWpS0qUb2Y2XNjnjMoKA2QQ= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Martijn Braam , Andrey Konovalov , Mickael GUENE , Benjamin GAIGNARD Date: Sat, 14 Mar 2020 01:38:53 +0200 Message-Id: <20200313233856.25202-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200313233856.25202-1-laurent.pinchart@ideasonboard.com> References: <20200313233856.25202-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/8] libcamera: v4l2_videodevice: Expose the device capabilities 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: Fri, 13 Mar 2020 23:39:08 -0000 Add a caps() function that exposes the V4L2 capabilities for the device. This is useful for generic code that can't hardcode any a priori knowledge of the device, such as in a simple pipeline handler. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/include/v4l2_videodevice.h | 2 ++ src/libcamera/v4l2_videodevice.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h index 72e7a50e6c3d..b2e12608084a 100644 --- a/src/libcamera/include/v4l2_videodevice.h +++ b/src/libcamera/include/v4l2_videodevice.h @@ -182,6 +182,8 @@ public: const char *deviceName() const { return caps_.card(); } const char *busName() const { return caps_.bus_info(); } + const V4L2Capability &caps() const { return caps_; } + int getFormat(V4L2DeviceFormat *format); int setFormat(V4L2DeviceFormat *format); ImageFormats formats(uint32_t code = 0); diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index ccc5faba3c27..86b262ba2436 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -625,6 +625,12 @@ void V4L2VideoDevice::close() * \return The string containing the device location */ +/** + * \fn V4L2VideoDevice::caps() + * \brief Retrieve the device V4L2 capabilities + * \return The device V4L2 capabilities + */ + std::string V4L2VideoDevice::logPrefix() const { return deviceNode() + (V4L2_TYPE_IS_OUTPUT(bufferType_) ? "[out]" : "[cap]");