From patchwork Wed Sep 11 09:35:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 21230 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 9A574C324C for ; Wed, 11 Sep 2024 09:36:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4A075634FD; Wed, 11 Sep 2024 11:36:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Is5W4NNL"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1AB6B634F9 for ; Wed, 11 Sep 2024 11:36:18 +0200 (CEST) Received: from pyrite.hamster-moth.ts.net (213-229-8-243.static.upcbusiness.at [213.229.8.243]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 843CABEB; Wed, 11 Sep 2024 11:35:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1726047300; bh=c6svChRR/G6yEUvhfG8OKLKYhvx8tqXtO3PGOJJc0V4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Is5W4NNL3nLfuAySdpDb8xZ+YA6zukbIwm96VxXi2/SZYLCQOaOAZmQaGqrS/FMAE X/JKW1Jhd0lC/mUsTcOwBaH/2je9G/JdBQ+rhHOxdcZ4Qf1UpTOxu2UH8ukLqYjL3A mXaQVDRgCiEokpOvC2S1ssmH5Hltvzz042PBl1aQ= From: Paul Elder To: libcamera-devel@lists.libcamera.org Cc: Paul Elder , stefan.klug@ideasonboard.com, Umang Jain Subject: [PATCH v3 2/3] apps: cam: Print control enum values more nicely Date: Wed, 11 Sep 2024 11:35:59 +0200 Message-Id: <20240911093600.671979-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240911093600.671979-1-paul.elder@ideasonboard.com> References: <20240911093600.671979-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 enum names can be obtained from ControlId, use that information to print out the list of supported enum values in --list-controls. Signed-off-by: Paul Elder Reviewed-by: Umang Jain --- Changes in v3: - s/enumName/enumToString/ No change in v2 --- src/apps/cam/camera_session.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp index 097dc4792..37de6c9f3 100644 --- a/src/apps/cam/camera_session.cpp +++ b/src/apps/cam/camera_session.cpp @@ -159,8 +159,16 @@ CameraSession::~CameraSession() void CameraSession::listControls() const { for (const auto &[id, info] : camera_->controls()) { - std::cout << "Control: " << id->name() << ": " - << info.toString() << std::endl; + if (info.values().size() == 0) { + std::cout << "Control: " << id->name() << ": " + << info.toString() << std::endl; + } else { + std::cout << "Control: " << id->name() << ": " << std::endl; + for (const auto &value : info.values()) { + int32_t val = value.get(); + std::cout << " - " << id->enumToString(val) << " (" << val << ")" << std::endl; + } + } } }