rpicamera: Initialize tuning file env var before lib init. Fixes #1344 (#1345)

This commit is contained in:
Benjamin Peter 2022-12-30 15:33:00 +01:00 committed by GitHub
parent 3a761e5e2f
commit d15bde3a59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -85,6 +85,9 @@ static int get_v4l2_colorspace(std::optional<libcamera::ColorSpace> const &cs) {
}
bool camera_create(parameters_t *params, camera_frame_cb frame_cb, camera_t **cam) {
// We make sure to set the environment variable before libcamera init
setenv("LIBCAMERA_RPI_TUNING_FILE", params->tuning_file, 1);
std::unique_ptr<CameraPriv> camp = std::make_unique<CameraPriv>();
camp->camera_manager = std::make_unique<CameraManager>();
@ -109,8 +112,6 @@ bool camera_create(parameters_t *params, camera_frame_cb frame_cb, camera_t **ca
return false;
}
setenv("LIBCAMERA_RPI_TUNING_FILE", params->tuning_file, 1);
ret = camp->camera->acquire();
if (ret != 0) {
set_error("Camera.acquire() failed");