From patchwork Sat Oct 17 11:17:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Mader X-Patchwork-Id: 28497 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 B76D3C324C for ; Sat, 17 Oct 2026 11:18:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E317468E4E; Sat, 17 Oct 2026 13:18:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=robert.mader@collabora.com header.b="LNYg+ad9"; dkim-atps=neutral Received: from sender5-op-o11.zoho.com (sender5-op-o11.zoho.com [165.173.182.11]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F55C68E43 for ; Sat, 17 Oct 2026 13:18:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; t=1792235885; cv=none; d=zohomail.com; s=zohoarc; b=EAzLhT2CekzBfoKMZbksDndW9xAtWxtH5M2Z589S6YNZ+RbrKcMWtWv2VCyCLH4O6i8RnJ6syvT6woKy7E6YoPD2Z3kadkIm6y4MQL2GQJoT/Hrcv9VvIx18BE/yqSP9jO3oMrEb8yRvA/3hslTt8nhaB37lRA2rNnkPPqmi664= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792235885; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=sSPTe05kq3ESFaN9viGgz3Nv33gR0jmLv3y3yCw+kPc=; b=i+aYapWJt3MKrRftUvadUY5PCNR0wbxxSb9tXxkEWTQHefJUj6rawAWvyEFeOD0Rp3aTrII5n2zIfqp9uVa0SAkYYdS9xsU8o6TrH7BZ7wIKAhe9tdI9nznNSFS5DzOAR3w1/oJVPdR1CUTaltp/PQuShEJzNGpS6R5V11rn69A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=robert.mader@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792235885; s=zohomail; d=collabora.com; i=robert.mader@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=sSPTe05kq3ESFaN9viGgz3Nv33gR0jmLv3y3yCw+kPc=; b=LNYg+ad9zuVq468dRP42f7sQLvl8RXf4+ZCVjeIId+NQ3wILdvLl7wh211v1WxMx zookvxfHP77BlKf0x/W9C+wqJimsbIEO3MXHT33oz+d6jEWFwI2oFMGAZfRsO7VJeaO u5gBTWI8Wnv8rgBFjwB+DaHqR26sVaK1vYzLnABM= Received: by smtp.zohomail.com with SMTPS id 1792235883337147.0080447896445; Sat, 17 Oct 2026 04:18:03 -0700 (PDT) From: Robert Mader To: libcamera-devel@lists.libcamera.org Cc: Robert Mader Subject: [PATCH v1] libcamera: pipeline_handler: Try more configuration file paths Date: Sat, 17 Oct 2026 13:17:58 +0200 Message-ID: <20261017111758.633101-1-robert.mader@collabora.com> X-Mailer: git-send-email 2.56.0 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" Similar to the global configuration file - configuration.yaml - check the user- and system-configuration paths for pipeline handlers. This is particularly useful on immutable OSs which typically don't allow writes to /usr/share. Signed-off-by: Robert Mader Closes https://gitlab.freedesktop.org/camera/libcamera/-/work_items/364 --- src/libcamera/pipeline_handler.cpp | 44 ++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index a803f6208c32..c23a11026279 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -628,6 +628,8 @@ void PipelineHandler::cancelRequest(Request *request) * * - If libcamera is not installed, the src/libcamera/pipeline/\/data/ * directory within the source tree ; otherwise + * - The user configuration (~/.config/libcamera/pipeline/\) directory. + * - The system configuration (etc/libcamera/pipeline/\) directory. * - The system data (share/libcamera/pipeline/\) directory. * * The system directories are not searched if libcamera is not installed. @@ -639,9 +641,8 @@ std::string PipelineHandler::configurationFile(const std::string &subdir, const std::string &name, bool silent) const { - std::string confPath; + std::vector confPaths; struct stat statbuf; - int ret; std::string root = utils::libcameraSourcePath(); if (!root.empty()) { @@ -652,25 +653,46 @@ std::string PipelineHandler::configurationFile(const std::string &subdir, * subdirectory of the corresponding pipeline handler. */ std::string confDir = root + "src/libcamera/pipeline/"; - confPath = confDir + subdir + "/data/" + name; + confPaths.push_back(confDir + subdir + "/data/" + name); LOG(Pipeline, Info) << "libcamera is not installed. Loading platform configuration file from '" - << confPath << "'"; + << confPaths.front() << "'"; } else { /* Else look in the system locations. */ - confPath = std::string(LIBCAMERA_DATA_DIR) - + "/pipeline/" + subdir + '/' + name; + std::filesystem::path userConfigurationDirectory; + const char *xdgConfigHome = utils::secure_getenv("XDG_CONFIG_HOME"); + if (xdgConfigHome) { + userConfigurationDirectory = xdgConfigHome; + } else { + const char *home = utils::secure_getenv("HOME"); + if (home) + userConfigurationDirectory = + std::filesystem::path(home) / ".config"; + } + + confPaths.push_back(std::string(userConfigurationDirectory) + "/libcamera"); + confPaths.push_back(std::string(LIBCAMERA_SYSCONF_DIR)); + confPaths.push_back(std::string(LIBCAMERA_DATA_DIR)); + + for (std::string &confPath : confPaths) { + confPath += "/pipeline/" + subdir + '/' + name; + } } - ret = stat(confPath.c_str(), &statbuf); - if (ret == 0 && (statbuf.st_mode & S_IFMT) == S_IFREG) - return confPath; + for (const std::string &confPath : confPaths) { + int ret = stat(confPath.c_str(), &statbuf); + if (ret == 0 && (statbuf.st_mode & S_IFMT) == S_IFREG) { + LOG(Pipeline, Debug) + << "Loading platform configuration file from '" + << confPath << "'"; + return confPath; + } + } if (!silent) LOG(Pipeline, Error) - << "Configuration file '" << confPath - << "' not found for pipeline handler '" + << "Configuration file not found for pipeline handler '" << PipelineHandler::name() << "'"; return std::string();