summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2022-12-06 14:02:30 +0100
committerJacopo Mondi <jacopo@jmondi.org>2022-12-09 08:57:41 +0100
commit870a3bde3d1fd8fe416b6d1d3dd5e7b92fbde174 (patch)
tree0f8cf1e5568bb733ddbf84de02b38cc1f766b4b6 /src
parent21c049cbcb66354867712825d642bd9fc6977015 (diff)
android: Allow to override config file path from env
The HAL config file is assumed to be in the LIBCAMERA_SYSCONF_DIR directory, which is defined by the meson build system at compile time. As the filesystem layout on Android installations might be device/build specific, allow to override such assumption using the LIBCAMERA_HAL_CONFIG_PATH environment variable and document its usage. While at it, remove quotes from the error message, as the file path doesn't contain any space. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/android/camera_hal_config.cpp9
1 files changed, 7 insertions, 2 deletions
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;
}