From patchwork Mon Jul 21 12:48:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23893 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 126E7BDCC1 for ; Mon, 21 Jul 2025 12:48:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 349EE68FE4; Mon, 21 Jul 2025 14:48:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="kJKO2r8B"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F0E168FB1 for ; Mon, 21 Jul 2025 14:48:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=6fJrKZp1xoOi5Ktn6/qxf9hfBzOKjfwMQhM9zi8gkkQ=; b=kJKO2r8BcEAcuKOIBwj1fdVCOP KhewQC/NtMhc86HB0kFmvqY3ys2nn0PZ+r1OBFQKyGw3xlVNCrtyUFcVJRYhn/Dr+miGvQAqQS6GG qaZkT5B6c+0uHckVquRXyjuYXXEmTBQs9ck3qFFfFy6eRaOtpp/5La3tbWwqMLkueZBLedGjBMBL0 kN2fdXGdSHr08KdkpdDQfwrPIaj0zDDmx/xxeooIxU4NV0uVnL2FFdMYwZygfwXn7AB7FeaBe1LQe gs2agBKBRPr0bGpVintNyhnrXiTatVmOiSOgUQvup1MNXqvc1Kj8RGCljWpMSibHh9VtFxmosy3EI P84LNfNg==; Received: from [49.36.71.87] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1udpwL-001hwV-9x; Mon, 21 Jul 2025 14:48:21 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Umang Jain , Kieran Bingham , =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v2] apps: cam: Print enum string for camera properties Date: Mon, 21 Jul 2025 18:18:26 +0530 Message-ID: <20250721124826.8584-1-uajain@igalia.com> X-Mailer: git-send-email 2.50.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" Some camera properties might be set as a enumeration for e.g. properties::Location. Instead of printing the int32_t values for the enumeration, print the enum string as well. This will enhance the readability for the user. Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham Tested-by: Kieran Bingham Reviewed-by: Barnabás Pőcze --- Changes in v2: - Comestic changes - Use id->enumerators() to detect controlID has enum values --- src/apps/cam/camera_session.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp index f63fcb22..1596a25a 100644 --- a/src/apps/cam/camera_session.cpp +++ b/src/apps/cam/camera_session.cpp @@ -236,7 +236,17 @@ void CameraSession::listProperties() const const ControlId *id = properties::properties.at(key); std::cout << "Property: " << id->name() << " = " - << value.toString() << std::endl; + << value.toString(); + + if (!id->enumerators().empty()) { + int32_t val = value.get(); + const auto &iter = id->enumerators().find(val); + + if (iter != id->enumerators().end()) + std::cout << " (" << iter->second << ")"; + } + + std::cout << std::endl; } }