[PATCH] qcam: Automatically select the camera if only one is available

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Oct 18 16:31:40 CEST 2024


Quoting Stanislaw Gruszka (2024-10-18 15:29:16)
> When only a single camera is available, showing the camera selection
> dialog is unnecessary. It's better to automatically select the available
> camera without prompting the user for input.
> 
> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka at linux.intel.com>
> ---
>  src/apps/qcam/main_window.cpp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp
> index 5144c6b3..b0dfd850 100644
> --- a/src/apps/qcam/main_window.cpp
> +++ b/src/apps/qcam/main_window.cpp
> @@ -303,6 +303,8 @@ int MainWindow::openCamera()
>          */
>         if (options_.isSet(OptCamera))
>                 cameraName = static_cast<std::string>(options_[OptCamera]);
> +       else if (cm_->cameras().size() == 1)
> +               cameraName = cm_->cameras()[0]->id();

I'm sold on that. I've wanted to do the same for some time ;-)

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

>         else
>                 cameraName = chooseCamera();
>  
> -- 
> 2.43.0
>


More information about the libcamera-devel mailing list