From patchwork Mon Oct 3 19:07:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17508 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 5C65EBD16B for ; Mon, 3 Oct 2022 19:07:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 170BB601CC; Mon, 3 Oct 2022 21:07:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664824034; bh=TXo14gQcgUcTpEPRDEYAh+LzXKS8k4ffaBrsnA1fkDg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=a0N6/IZ4D6vPKmRMmEEeNcVSG6Xh6xAFL6ldwNgD6JeDKFBqsLK69/sByJEmZnv6L 7p9ZmRFMfqcLeW9OoftBnPsFw7FNk1hoYDUNOTrhyi7SWeMrerBwzG5Ihl/0pEqhBO bVIhYQ9rDI2ZNNqIPuixzIV2nISy1U6oi7wYYiiVRu+yv6hogjfWiydXk5j7zIZvvE xFjQjtyz1zeeGiBK0DK6Km5wj2Gwx1Jt3MKfHdErCbBi/K0hdgMTkonK4odQYP9dw7 o8x6etBqMdc/FmnhIeVTJkqC5cAoOhGTNekVVcS/QcX0gpAAthYHAnGtdK+BsES8gE FHb0VP6u+sJRg== 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 CB87E601C8 for ; Mon, 3 Oct 2022 21:07:10 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="VYCdKh74"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 45CB5519; Mon, 3 Oct 2022 21:07:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1664824030; bh=TXo14gQcgUcTpEPRDEYAh+LzXKS8k4ffaBrsnA1fkDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VYCdKh74SXgGdCOtCxKHaKBv3+XZrbzvBqdOgNZduhai97/tufghjtBaDQnFRALK5 gu6RosebsBqkrOKShDUr+gvIFLR8R/L9Id8iJysnDRWKyl1khka5J0h2agnw3Iywc5 vsQT/RujgYQm7z/RBcVacRGaUtTAPoAtc+AO+qPc= To: libcamera-devel@lists.libcamera.org Date: Mon, 3 Oct 2022 22:07:05 +0300 Message-Id: <20221003190706.19816-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221003190706.19816-1-laurent.pinchart@ideasonboard.com> References: <20221003190706.19816-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] test: v4l2_m2mdevice: Test control enumeration 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-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Verify that the V4L2M2MDevice correctly enumerates controls supported by the device. The test currently fails, and will be fixed by a subsequent patch. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Xavier Roumegue --- test/v4l2_videodevice/v4l2_m2mdevice.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/v4l2_videodevice/v4l2_m2mdevice.cpp b/test/v4l2_videodevice/v4l2_m2mdevice.cpp index 852b853fa81a..c45f581a8653 100644 --- a/test/v4l2_videodevice/v4l2_m2mdevice.cpp +++ b/test/v4l2_videodevice/v4l2_m2mdevice.cpp @@ -95,6 +95,11 @@ protected: V4L2VideoDevice *capture = vim2m_->capture(); V4L2VideoDevice *output = vim2m_->output(); + if (capture->controls().empty() || output->controls().empty()) { + cerr << "VIM2M device has no control" << endl; + return TestFail; + } + V4L2DeviceFormat format = {}; if (capture->getFormat(&format)) { cerr << "Failed to get capture format" << endl; From patchwork Mon Oct 3 19:07:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17509 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 145ADC327C for ; Mon, 3 Oct 2022 19:07:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 76C62601C8; Mon, 3 Oct 2022 21:07:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664824034; bh=hufLD+mmkg7h3scBOVrcezyPVc3ZDGhFQNyJpBtuRWw=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=h5MlhdGgGP68BQgCq0KTVqvnUefz25mA3X1FOVYwea/XbzrcfwLZuliJ2V4msjM8H 7qdCX/pkDktgkXkuy6Th3PfqKYblvywcPHbSNf9uy4pRGyz6O3jyBiPfLGqcDL+bK8 Z1ojkZfpb8PbpAaajoi+nHBcp9UJO4vSE6KUFdVlvLlDFea57aU188z0JTcohqDd35 SjyZuN7wR5IXUqQixyAi4JgADpJ4nA2XzpYdIcPl1W4AFgPHsY6Xkw1zLSAJHewWqi Fftju+qi1WdqE8VYrwSJAMzazygigeOsIUiIDWPqMpNpTVS9RSI5BHUHvIt5hmvhip OU4g7LFUPE4ug== 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 56F74601C2 for ; Mon, 3 Oct 2022 21:07:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ayoaxPkR"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D2CB1519; Mon, 3 Oct 2022 21:07:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1664824032; bh=hufLD+mmkg7h3scBOVrcezyPVc3ZDGhFQNyJpBtuRWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ayoaxPkRn2LG6g0qdJh+6GQTYmBcfkHSVg/v1omniZ4gVQggUvJDcScIR3RCobnHV n+tUwPs8XS1Gpflk5ft8l1LJU/3rkQQV0+b5h+jnm6+5UJ5VhRFzFN+0LP5wkMnS89 Fw7jW8YJq5V8N44dyac+a0Jqa3OoxNSeRrPpscZ4= To: libcamera-devel@lists.libcamera.org Date: Mon, 3 Oct 2022 22:07:06 +0300 Message-Id: <20221003190706.19816-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221003190706.19816-1-laurent.pinchart@ideasonboard.com> References: <20221003190706.19816-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: v4l2_device: List controls when setting file descriptor 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-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The base V4L2Device class is bound to a video device node by either open(), which opens the device node and creates a new file descriptor, or setFd(), which takes an already open file descriptor. The former populates the V4L2Device instance controls, while the latter doesn't. This prevents using controls on V4L2 M2M devices. Fix it by populating controls in setFd(), which is called by open(). Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Xavier Roumegue --- src/libcamera/v4l2_device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index d7ebf63811b4..c4d40d7d0842 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -97,8 +97,6 @@ int V4L2Device::open(unsigned int flags) setFd(std::move(fd)); - listControls(); - return 0; } @@ -129,6 +127,8 @@ int V4L2Device::setFd(UniqueFD fd) fdEventNotifier_->activated.connect(this, &V4L2Device::eventAvailable); fdEventNotifier_->setEnabled(false); + listControls(); + return 0; }