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; }