From patchwork Fri Oct 18 14:29:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Gruszka X-Patchwork-Id: 21680 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 8EAAEC32AF for ; Fri, 18 Oct 2024 14:29:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3D3E76538F; Fri, 18 Oct 2024 16:29:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="eKk5oI6Y"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AD2C4633C6 for ; Fri, 18 Oct 2024 16:29:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729261762; x=1760797762; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=7gcaP2kB6ASTteaXOjfxNAhsaQW93aP55/00mYA5qE8=; b=eKk5oI6Y1Y1ISRRkPSHExrweDwkJDLXAMYTIyffoS+xKXbI0sCmlvs1w 63mBt25f9XzXlSGZxJm9ymKFgr9Ef9xmSKi9v1eJMMSiorVRhmtzxLrh5 xY3qlWLug6bBEnz3g4vaWFEmBW1Ga7fqvbqHKNC8r3dXHkWqu7xvmKMMS fP3CT0u/e05iORWnmBME7J9jDcC4prDk8zoOXb7IhptIjuW+dXbBsSEd+ k6DU8hta3vdCzPduKLagCN57CNaRzMnaUhXPHFIWzWWCvTWgf1Q4XHLmU hmflVMjYsWsMFNozFsn2eUNYJ3876BqLfk6t+y3+vuGk9wViwR8WDtQ7y g==; X-CSE-ConnectionGUID: d94sV7S7S/ODkLp0KBnqnA== X-CSE-MsgGUID: r6kVIHuCRpOtaCi/inIWJQ== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="28674546" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="28674546" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2024 07:29:20 -0700 X-CSE-ConnectionGUID: M42xN+jHRkWTuF+/xeDqUg== X-CSE-MsgGUID: pmV2/gG6Q3OTJoHIcJSBxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,213,1725346800"; d="scan'208";a="78480920" Received: from sgruszka-mobl.ger.corp.intel.com (HELO localhost) ([10.245.97.183]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2024 07:29:19 -0700 From: Stanislaw Gruszka To: libcamera-devel@lists.libcamera.org Subject: [PATCH] qcam: Automatically select the camera if only one is available Date: Fri, 18 Oct 2024 16:29:16 +0200 Message-Id: <20241018142916.23578-1-stanislaw.gruszka@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Kieran Bingham --- 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(options_[OptCamera]); + else if (cm_->cameras().size() == 1) + cameraName = cm_->cameras()[0]->id(); else cameraName = chooseCamera();