From patchwork Fri Jan 10 02:39:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 22507 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 BAF8CC32F5 for ; Fri, 10 Jan 2025 02:39:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A54C7684F3; Fri, 10 Jan 2025 03:39:25 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RkgR89r1"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A13A0608A9 for ; Fri, 10 Jan 2025 03:39:23 +0100 (CET) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3FD1578C; Fri, 10 Jan 2025 03:38:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1736476709; bh=nfKvoUwrWtJbp6jJgfiX01ZdiWp/m1VDa6p8CxYdeco=; h=From:To:Cc:Subject:Date:From; b=RkgR89r1T+Ue9ZP55HcJ03giK3WpQ3DxHJsXOeNBmFrnCC8xn2yTj6CtobGRyfw2O I1MtcCEFaUdm6LTjcxbb3iOD3PGMo/FSzWUJ46gEinWSsNn6MW/mxFXejF7Bp9YdJy 0XS+++ha6MH3vi2kRowREviajJeoNES7J2SuyBYs= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= , Julien Vuillaumier , Harvey Yang Subject: [PATCH 1/2] libcamera: pipeline_handler: Enable silent configuration file lookup Date: Fri, 10 Jan 2025 04:39:19 +0200 Message-ID: <20250110023920.28502-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 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 PipelineHandler::configurationFile() function prints an error message when no configuration file is found. It can be useful for pipeline handlers to silence the lookup operation and handle errors themselves. Add a silent parameter to the function to enable this. Signed-off-by: Laurent Pinchart Tested-by: Julien Vuillaumier Reviewed-by: Kieran Bingham --- include/libcamera/internal/pipeline_handler.h | 3 ++- src/libcamera/pipeline_handler.cpp | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) base-commit: d49a84a4f3aa63efc900564ff32558e4f5d85b04 diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index fb28a18d0f4668ab..972a2fa65310e1d9 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -63,7 +63,8 @@ public: void cancelRequest(Request *request); std::string configurationFile(const std::string &subdir, - const std::string &name) const; + const std::string &name, + bool silent = false) const; const char *name() const { return name_; } diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index caa5c20e74836956..d84dff3c9f198756 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -581,6 +581,7 @@ void PipelineHandler::cancelRequest(Request *request) * \brief Retrieve the absolute path to a platform configuration file * \param[in] subdir The pipeline handler specific subdirectory name * \param[in] name The configuration file name + * \param[in] silent Disable error messages * * This function locates a named platform configuration file and returns * its absolute path to the pipeline handler. It searches the following @@ -596,7 +597,8 @@ void PipelineHandler::cancelRequest(Request *request) * string if no configuration file can be found */ std::string PipelineHandler::configurationFile(const std::string &subdir, - const std::string &name) const + const std::string &name, + bool silent) const { std::string confPath; struct stat statbuf; @@ -626,9 +628,11 @@ std::string PipelineHandler::configurationFile(const std::string &subdir, if (ret == 0 && (statbuf.st_mode & S_IFMT) == S_IFREG) return confPath; - LOG(Pipeline, Error) - << "Configuration file '" << confPath - << "' not found for pipeline handler '" << PipelineHandler::name() << "'"; + if (!silent) + LOG(Pipeline, Error) + << "Configuration file '" << confPath + << "' not found for pipeline handler '" + << PipelineHandler::name() << "'"; return std::string(); }