From patchwork Wed Nov 27 08:50:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 22110 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 05FDDC3213 for ; Wed, 27 Nov 2024 08:50:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 55256660BA; Wed, 27 Nov 2024 09:50:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="caEjc5r9"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 351A1660A6 for ; Wed, 27 Nov 2024 09:50:34 +0100 (CET) Received: from neptunite.hamster-moth.ts.net (unknown [IPv6:2404:7a81:160:2100:7dcc:a4ea:e361:d355]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2B99B78C; Wed, 27 Nov 2024 09:50:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1732697411; bh=cX5nQSRcDWO83OY0jrG9fUL+Knpo/lbJOy42ShydeSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=caEjc5r9maS3LqQCmtqxpICkSV+MWveQaJjFXlySvQ2cTC01nlsWeqf66opImNu3K GlxaWBYc15vcq6M8Qt0M6y58uy4UtGfDhwz04nb7L/jO7x9rDV5+OQZZxM5hFslX4X sRXCx5aai09DgeNnylpebq12aKgb6/PAueURIgVc= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Paul Elder Subject: [PATCH v2 4/4] apps: cam: Print control direction information Date: Wed, 27 Nov 2024 17:50:17 +0900 Message-Id: <20241127085017.2192069-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241127085017.2192069-1-paul.elder@ideasonboard.com> References: <20241127085017.2192069-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: [in ] libcamera::FrameDurationLimits: [16666..33333] Size: 2 Signed-off-by: Paul Elder --- 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()) {