From patchwork Thu Apr 27 07:16:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18562 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 08EDFC0DA4 for ; Thu, 27 Apr 2023 07:18:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6BA1C627D1; Thu, 27 Apr 2023 09:18:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1682579905; bh=uB+BRb7BNK8OtUAotNtK7xOG1y07NAFCHW6mk6pmA0w=; 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=yUqAP3ciaeDwBp2R2Dh4QqfODDXhTJMAhVhKzlD4iiFH46h04iQmlDnjxHaUzTggp Du1zfT+U+/I5aLS4eGKHchehdvGrDg4BAPNsZBOsC+d3vp221CmyQiaWrGb4z/I7Kx gyVcEMAYZAPLVt9ACcVDtHV6GGfVDsICeV+iB/1hQ9NJ/KAYlYiN4Ktkf/JOEt0hbP C/B07qYQI4ZucnSqV54ELcI1rimb+SpnrpwFTflAd0Ghp+AkKrFdoxWzOnZkrAkgJ0 alggTd/JJ/HxmhYDmqr8ZeGB0Cjcm8rY8HGGMmxGXfa6Q47IOyjCuIG2wn0zZ+0Sgc SidBfRvOBhOVg== Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E8C4627D1 for ; Thu, 27 Apr 2023 09:18:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="dDW1q+Px"; dkim-atps=neutral Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3f18dacd392so50050715e9.0 for ; Thu, 27 Apr 2023 00:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1682579902; x=1685171902; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d8D8b8rfewMtDh0RzsnJyjugoTZZ5Fj+dvSSJkOoOWM=; b=dDW1q+PxXzN57ATsoYXjh4l5PrlggtrzwZhApbHqqOdleR+SbcUnSHOvG3rk9VV5Fb TjskboYtHEN3Jm/0YxZXKtdt6a/yagSG8nNRDNoggwm4t5sPgyj/wOGdnmSeEb5boRtF UGsHGn7KBpzC/qFYdVwaaYL2Za9+5lMVXB0JM5nm9UUWYGhtfMO3HIfVnk+Lx5EB4zx0 XfA6HPcDnDM6X/PJASZPFbzWkcN2JJwsfkdZEoJAHWjx0XWQZDDDmk+eckCBmDKT6D32 8TsA0Tdb+9Q+toAwyxs+vFInwtIYsSRoC9etkbnYE4KiZsPXSnDngkYQu+5duw5KGnSL w4tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682579902; x=1685171902; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d8D8b8rfewMtDh0RzsnJyjugoTZZ5Fj+dvSSJkOoOWM=; b=EIE2pIUdhT3CINRpRX+rrO401qPkwVb7xTbX+LbkGWXH+WWB9LXGjKCCD0FgmeJf6k GxyEz0lMpCVRWoJamZKnjEHCI442FkhvDwzAZZ982JfhWFAxaAXgCOIUYfHBp/95alrp 2QvigYM0HTFbwv+CWqRQJcpCFuq4ycDsUfMAiiGghn7OLQG7pLSsztWCgEMPcT0+022T cRm+jEJtoXuJMqj9FAzzSI75HHSiOh+w4Tkr+6Xt1JnsOLvkUisUwurPi6DqfH7V5nYf jFDul03GSWcsR7cM+jvkQ1Y5aA0eEfHPmaBXeGUQ/GnYIie9wiBgeyHHhXmLYhDrbEX8 hcJw== X-Gm-Message-State: AC+VfDw7xh9oz7nkeKlnVfKdU2cRa7ogcriJVtUqNWNEBTQWpJf9THLU MHVswPqjp8vI+HYj9D+EJIGG+NZC3Wy0m8UwHaMgXw== X-Google-Smtp-Source: ACHHUZ6aT3FuDmIGffs8dQ3qrUfGFuV6XVshRfxiyrTfR3akNPLQFIyw6hwnYO8UJvx/u+Ae84XiZA== X-Received: by 2002:a7b:cbd5:0:b0:3f0:8108:406 with SMTP id n21-20020a7bcbd5000000b003f081080406mr595676wmi.28.1682579901721; Thu, 27 Apr 2023 00:18:21 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id c21-20020a7bc855000000b003f17300c7dcsm20136106wml.48.2023.04.27.00.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 00:18:20 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 27 Apr 2023 08:16:52 +0100 Message-Id: <20230427071652.25828-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230426131057.21550-3-naush@raspberrypi.com> References: <20230426131057.21550-3-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: ipa_proxy: Allow a prefix for the configuration file 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: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a prefix parameter to IPAProxy::configurationFile(). This prefix is added to the search path when locating IPA configuration files in the system directories. For example, the system directories etc/libcamera/ipa// and share/libcamera/ipa// will be used to search for the IPA configuration files. Signed-off-by: Naushir Patuck --- include/libcamera/internal/ipa_proxy.h | 3 ++- src/libcamera/ipa_proxy.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/libcamera/internal/ipa_proxy.h b/include/libcamera/internal/ipa_proxy.h index 781c8b623605..9235b582edad 100644 --- a/include/libcamera/internal/ipa_proxy.h +++ b/include/libcamera/internal/ipa_proxy.h @@ -31,7 +31,8 @@ public: bool isValid() const { return valid_; } - std::string configurationFile(const std::string &file) const; + std::string configurationFile(const std::string &file, + const std::string &prefix = "") const; protected: std::string resolvePath(const std::string &file) const; diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp index 3f2cc6b89f60..4a27b0a993fa 100644 --- a/src/libcamera/ipa_proxy.cpp +++ b/src/libcamera/ipa_proxy.cpp @@ -72,6 +72,7 @@ IPAProxy::~IPAProxy() /** * \brief Retrieve the absolute path to an IPA configuration file * \param[in] name The configuration file name + * \param[in] prefix The configuration directory prefix when searching system paths * * This function locates the configuration file for an IPA and returns its * absolute path. It searches the following directories, in order: @@ -80,8 +81,8 @@ IPAProxy::~IPAProxy() * environment variable ; or * - If libcamera is not installed, the src/ipa/ directory within the source * tree ; otherwise - * - The system sysconf (etc/libcamera/ipa) and the data (share/libcamera/ipa/) - * directories. + * - The system sysconf (etc/libcamera/ipa//) and the data + * (share/libcamera/ipa//) directories. * * The system directories are not searched if libcamera is not installed. * @@ -92,7 +93,8 @@ IPAProxy::~IPAProxy() * \return The full path to the IPA configuration file, or an empty string if * no configuration file can be found */ -std::string IPAProxy::configurationFile(const std::string &name) const +std::string IPAProxy::configurationFile(const std::string &name, + const std::string &prefix) const { struct stat statbuf; int ret; @@ -139,7 +141,8 @@ std::string IPAProxy::configurationFile(const std::string &name) const } else { /* Else look in the system locations. */ for (const auto &dir : utils::split(IPA_CONFIG_DIR, ":")) { - std::string confPath = dir + "/" + ipaName + "/" + name; + std::string confPath = dir + "/" + prefix + "/" + + ipaName + "/" + name; ret = stat(confPath.c_str(), &statbuf); if (ret == 0 && (statbuf.st_mode & S_IFMT) == S_IFREG) return confPath;