From patchwork Mon Nov 25 15:30:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 22080 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 5E93BC32A3 for ; Mon, 25 Nov 2024 15:30:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F01A666040; Mon, 25 Nov 2024 16:30:24 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="meH5007X"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 36DCD6603D for ; Mon, 25 Nov 2024 16:30:20 +0100 (CET) Received: from neptunite.flets-east.jp (unknown [IPv6:2404:7a81:160:2100:9d06:dcbb:7303:4be6]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A0B4912E9; Mon, 25 Nov 2024 16:29:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732548598; bh=Mv19DzoGdexe9gDai8YxU1/+ZgP8sxyLMS2T2pqJB2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=meH5007XPkv0UM6RZGhUfGSfRc/RmHyKhzeHNBVSi9ATKOiMsj8gFsVFrkNHRozYq 4il4s8hdBQ7l7j6z42MHvGlvTZ2ew3dVX5iaoJ+jIO9W1yHQlf5/gUPhGy+gsgXVpq Wn/qrrf5GYCyUjWe4icVJGliOOL1qyZRASMyjrew= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Paul Elder Subject: [PATCH 4/4] apps: cam: Print control direction information Date: Tue, 26 Nov 2024 00:30:03 +0900 Message-Id: <20241125153003.3309066-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241125153003.3309066-1-paul.elder@ideasonboard.com> References: <20241125153003.3309066-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: [io] draft::FaceDetectMode: - FaceDetectModeOff (0) Control: [i ] libcamera::FrameDurationLimits: [16666..33333] Size: 2 Signed-off-by: Paul Elder --- 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..1baf36fcfd3c 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() ? "i" : " ") + << (id->isOutput() ? "o" : " ") + << "] "; + 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()) {