[libcamera-devel] [PATCH] libcamera: ipa_proxy: Allow a prefix for the configuration file

Jacopo Mondi jacopo.mondi at ideasonboard.com
Thu Apr 27 10:10:04 CEST 2023


Hi Naush

On Thu, Apr 27, 2023 at 08:16:52AM +0100, Naushir Patuck via libcamera-devel wrote:
> 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/<prefix>/ and
> share/libcamera/ipa/<prefix>/ will be used to search for the IPA
> configuration files.
>
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> ---
>  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/<prefix>/) and the data
> + *   (share/libcamera/ipa/<prefix>/) directories.

Doxygen doesn't seem happy with <prefix>

src/libcamera/ipa_proxy.cpp:83: warning: Unsupported xml/html tag <prefix> found
src/libcamera/ipa_proxy.cpp:84: warning: Unsupported xml/html tag <prefix> found


>   *
>   * 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;
> --
> 2.34.1
>


More information about the libcamera-devel mailing list