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

Stanislaw Gruszka stanislaw.gruszka at linux.intel.com
Fri Oct 18 16:29:16 CEST 2024


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();
 	else
 		cameraName = chooseCamera();
 
-- 
2.43.0



More information about the libcamera-devel mailing list