From patchwork Thu Jul 3 14:06:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 23740 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 B1A8DBDCBF for ; Thu, 3 Jul 2025 14:06:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 579F868E4B; Thu, 3 Jul 2025 16:06:33 +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="RTffKCaQ"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B4F4461528 for ; Thu, 3 Jul 2025 16:06:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type: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=O/6D2LvDFXEMdEhUPOMsiiWBM9UiVGsJzWk31GdoUQQ=; b=RTffKCaQvwCMVtXdsO/y8Gzudi LYzcF70EcDohN+HUpv3uNE4BTierjgr+xbYK87b0jFtl1v7Dm9vo1U3BGRKI1lQlMJtKjBIPHZKL7 y+/2ZpjYAGfBr+ZcVTKZOrMzw0LG3PkU9i4zR94IpKXIogvZAJVvdnGHyxUGW8Cz1FxXGUmT9wVTG 4ai/DsPe1axsy/0bKbckM0jI84zUngFpzl/yFlTQmNFWAJav9P/dSCT/KlaBmYwO93ZmKzAWM6Zkl yrvkzKaw1XYWxLcIdzztxqYyX4soU7bdSQLbvtesNqNCza9UjwOgWbVazB0rK0akUcyKKs8ILHl8W 1iyuljUw==; Received: from [49.36.71.127] (helo=uajain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uXKa5-00Bvsn-N8; Thu, 03 Jul 2025 16:06:30 +0200 From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Umang Jain Subject: [PATCH] apps: cam: Print enum string for camera properties Date: Thu, 3 Jul 2025 19:36:31 +0530 Message-ID: <20250703140631.29979-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 --- 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..feef1585 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 (value.type() == ControlTypeInteger32) { + 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; } }