diff options
author | David Plowman <david.plowman@raspberrypi.com> | 2021-07-07 14:40:51 +0100 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-07-12 20:45:42 +0300 |
commit | eb9a539938c38b53f87c253884b2d94c7466b2d4 (patch) | |
tree | 68ee47308d4931c97f9c62cdd11333a789626643 /src | |
parent | d6d4710d047528a60c5e436c9bd0b29301c40f3c (diff) |
libcamera: raspberrypi: Allow the tuning file to be set by an environment variable
The configuration (camera tuning) file used by the Raspberry Pi comes
by default from the sensor name. However, we now allow this to be
overridden by the LIBCAMERA_RPI_TUNING_FILE environment variable.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 54d3c8ed..f821d8fe 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1233,8 +1233,18 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig) ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls); ipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls); - IPASettings settings(ipa_->configurationFile(sensor_->model() + ".json"), - sensor_->model()); + /* + * The configuration (tuning file) is made from the sensor name unless + * the environment variable overrides it. + */ + std::string configurationFile; + char const *configFromEnv = utils::secure_getenv("LIBCAMERA_RPI_TUNING_FILE"); + if (!configFromEnv || *configFromEnv == '\0') + configurationFile = ipa_->configurationFile(sensor_->model() + ".json"); + else + configurationFile = std::string(configFromEnv); + + IPASettings settings(configurationFile, sensor_->model()); return ipa_->init(settings, sensorConfig); } |