diff options
-rw-r--r-- | Documentation/environment_variables.rst | 18 | ||||
-rw-r--r-- | src/android/camera_hal_config.cpp | 9 |
2 files changed, 25 insertions, 2 deletions
diff --git a/Documentation/environment_variables.rst b/Documentation/environment_variables.rst index f092cbbd..ef2794f0 100644 --- a/Documentation/environment_variables.rst +++ b/Documentation/environment_variables.rst @@ -37,6 +37,12 @@ LIBCAMERA_IPA_MODULE_PATH Example value: ``${HOME}/.libcamera/lib:/opt/libcamera/vendor/lib`` +LIBCAMERA_HAL_CONFIG_PATH + Define custom search location for the Android HAL config file + ``camera_hal.yaml`` (`more <HAL config_>`__). + + Example value: ``/system/etc/libcamera``, ``/vendor/etc/libcamera`` + Further details --------------- @@ -149,3 +155,15 @@ operation are the installed system path (for example on Debian: ``/usr/local/x86_64-pc-linux-gnu/libcamera``) and the build directory. With the ``LIBCAMERA_IPA_MODULE_PATH``, you can specify a non-default location to search for IPA modules. + +HAL config +~~~~~~~~~~ + +The Android camera HAL requires a configuration file where all built-in cameras +and their properties are enumerated (pluggable cameras, such as UVC cameras do +not need to be described there). The HAL configuration file has to be named +`camera_hal.yaml` and its default location is ``LIBCAMERA_SYSCONF_DIR`` which +can be overridden by using the ``LIBCAMERA_HAL_CONFIG_PATH`` environment +variable. + +`Examples <https://git.libcamera.org/libcamera/libcamera.git/tree/src/android/data>`__ diff --git a/src/android/camera_hal_config.cpp b/src/android/camera_hal_config.cpp index 0e7cde63..0942263c 100644 --- a/src/android/camera_hal_config.cpp +++ b/src/android/camera_hal_config.cpp @@ -11,6 +11,7 @@ #include <libcamera/base/file.h> #include <libcamera/base/log.h> +#include <libcamera/base/utils.h> #include "libcamera/internal/yaml_parser.h" @@ -159,12 +160,16 @@ CameraHalConfig::CameraHalConfig() */ int CameraHalConfig::parseConfigurationFile() { - std::string filePath = LIBCAMERA_SYSCONF_DIR "/camera_hal.yaml"; + const char *configPath = utils::secure_getenv("LIBCAMERA_HAL_CONFIG_PATH"); + if (!configPath) + configPath = LIBCAMERA_SYSCONF_DIR; + std::string filePath(configPath); + filePath += "/camera_hal.yaml"; File file(filePath); if (!file.exists()) { LOG(HALConfig, Debug) - << "Configuration file: \"" << filePath << "\" not found"; + << "Configuration file " << filePath << " not found"; return -ENOENT; } |