device: some v4l2 cameras do not accept parameters unless streaming

This fixes 3DO camera not accepting `--camera-options=focus_absolute=100`
and `--camera-options=focus_automatic_continuous=0`, and not properly
configuring the sensor.

The settings are applied twice (if failed) to ignore ordering problems
related to auto-focus and focus-absolute value command line order.
This commit is contained in:
Kamil Trzcinski
2023-11-20 21:28:31 +01:00
parent 82dea910bc
commit 3c116f2307
3 changed files with 21 additions and 5 deletions

View File

@ -99,7 +99,15 @@ void camera_capture_add_callbacks(camera_t *camera, buffer_list_t *capture, link
int camera_set_params(camera_t *camera)
{
device_set_fps(camera->camera, camera->options.fps);
device_set_option_list(camera->camera, camera->options.options);
// HACK:
// Some cameras require to be in streaming to apply settings
// This applies twice to avoid ordering issues (auto-focus vs focus value)
if (camera->camera->n_capture_list > 0)
buffer_list_set_stream(camera->camera->capture_lists[0], true);
if (device_set_option_list(camera->camera, camera->options.options) < 0)
device_set_option_list(camera->camera, camera->options.options);
device_set_option_list(camera->isp, camera->options.isp.options);
if (camera->options.auto_focus) {