From patchwork Mon Mar 17 18:11:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22971 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 17D07C32F5 for ; Mon, 17 Mar 2025 18:11:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D69F06894D; Mon, 17 Mar 2025 19:11:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WhTIzT/v"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9325D68928 for ; Mon, 17 Mar 2025 19:11:44 +0100 (CET) Received: from pb-laptop.local (185.221.143.221.nat.pool.zt.hu [185.221.143.221]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0F0A9D77 for ; Mon, 17 Mar 2025 19:10:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742235003; bh=KkRZ6MY9keo+fGJuAC/kdemJ341+pkcsrJKr0N0Sfq0=; h=From:To:Subject:Date:From; b=WhTIzT/veq6nWVbXjAhHRYM38dBUL11N39gL7Rv4wae9C9Idvc/Kwf2uqog/cH0yu ktCvenBPA88mTQ07O//2qG3wgubpG2p58Fcxf/kYBaMlzZokjxwaeSfzDEg8CWYxg1 xCpMmBKSTpHFM8XHi7ry5jPxUhAPfBEI16k8VjHY= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1] apps: cam: Highlight default enumerator Date: Mon, 17 Mar 2025 19:11:41 +0100 Message-ID: <20250317181141.214118-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.49.0 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" Print "[default]" after the default enumerator when listing controls. Example: $ cam -c 1 --list-controls [...] Control: [inout] libcamera::ExposureTimeMode: - ExposureTimeModeAuto (0) [default] - ExposureTimeModeManual (1) Signed-off-by: Barnabás Pőcze Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/apps/cam/camera_session.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp index 9e9348277..8a555339c 100644 --- a/src/apps/cam/camera_session.cpp +++ b/src/apps/cam/camera_session.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -173,6 +174,11 @@ void CameraSession::listControls() const std::cout << "Control: " << io.str() << id->vendor() << "::" << id->name() << ":" << std::endl; + + std::optional def; + if (!info.def().isNone()) + def = info.def().get(); + for (const auto &value : info.values()) { int32_t val = value.get(); const auto &it = id->enumerators().find(val); @@ -182,7 +188,10 @@ void CameraSession::listControls() const std::cout << "UNKNOWN"; else std::cout << it->second; - std::cout << " (" << val << ")" << std::endl; + + std::cout << " (" << val << ")" + << (val == def ? " [default]" : "") + << std::endl; } }