From patchwork Thu Dec 12 05:24:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 22298 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 4B0C0C3260 for ; Thu, 12 Dec 2024 05:25:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B431667ECC; Thu, 12 Dec 2024 06:25:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="sj+8+o4+"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 91D6E67EC7 for ; Thu, 12 Dec 2024 06:25:14 +0100 (CET) Received: from neptunite.flets-east.jp (unknown [IPv6:2404:7a81:160:2100:39eb:989c:b016:217b]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C7A25316; Thu, 12 Dec 2024 06:24:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733981081; bh=8IyJy90D4lCm9eoq8UzJz+G25Kc2WGnEHEjOERbx1n0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sj+8+o4+VJh4qGFxRcGaoj2i1EUa1r8hwVWEPxnp1YfoMq8XthxkVZUs1Z7LZw81K HPPkJMKfJe7uPjxusrZ4ue//C0mXXbA3VlkEBEA8YSCpP91pjf8PZzAdnbXZ6cMZGI 7GTlUIalP6zcGlckBlTc3uHOGn8TbnEw2EWK37fs= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Paul Elder , Kieran Bingham , Laurent Pinchart Subject: [PATCH v4 4/4] apps: cam: Print control direction information Date: Thu, 12 Dec 2024 14:24:38 +0900 Message-Id: <20241212052438.1547410-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241212052438.1547410-1-paul.elder@ideasonboard.com> References: <20241212052438.1547410-1-paul.elder@ideasonboard.com> 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" Now that there is support for retrieving the allowed directions of a control, print this information when listing controls. Sample output: $ cam --list-controls -c 2 Using camera Virtual0 as cam0 Control: [inout] draft::FaceDetectMode: - FaceDetectModeOff (0) Control: [inout] libcamera::FrameDurationLimits: [16666..33333] Size: 2 Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- No change in v4 No change in v3 Changes in v2: - s/i/in/, s/o/out/ so that the output is easier to read --- src/apps/cam/camera_session.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp index 6e9890ccfda1..9e93482775c3 100644 --- a/src/apps/cam/camera_session.cpp +++ b/src/apps/cam/camera_session.cpp @@ -159,12 +159,18 @@ CameraSession::~CameraSession() void CameraSession::listControls() const { for (const auto &[id, info] : camera_->controls()) { + std::stringstream io; + io << "[" + << (id->isInput() ? "in" : " ") + << (id->isOutput() ? "out" : " ") + << "] "; + if (info.values().empty()) { - std::cout << "Control: " + std::cout << "Control: " << io.str() << id->vendor() << "::" << id->name() << ": " << info.toString() << std::endl; } else { - std::cout << "Control: " + std::cout << "Control: " << io.str() << id->vendor() << "::" << id->name() << ":" << std::endl; for (const auto &value : info.values()) {