From patchwork Thu Apr 16 23:26:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 26520 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 8D86ABDCBD for ; Thu, 16 Apr 2026 23:26:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8FD5662EC5; Fri, 17 Apr 2026 01:26:35 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="C3gAX1mO"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BAB3762647 for ; Fri, 17 Apr 2026 01:26:33 +0200 (CEST) Received: from charm.ideasonboard.com (ams.linuxembedded.co.uk [209.38.108.23]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A48EA2EC; Fri, 17 Apr 2026 01:24:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1776381898; bh=sg2I9f0iOT5N7mHWPfPQIcxBtJRDMAe5UZqL/+3WO9g=; h=From:To:Cc:Subject:Date:From; b=C3gAX1mObE6sJN3mREy932fyGlBtn3sNqzjK5W+KX8XI0z0imVOuxuMyKHlVALWnM wF9u23KAciI5fZSNdRpmnN4o2VIwHt+Hy8uQXpPP2L9+KjtdTEsNaaWhI1JKPauX3+ fYC1emmfjlrL6uafCWggKiDrrAU+cfcmq8LDnBC8= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH] cam: Add option to report libcamera version Date: Fri, 17 Apr 2026 00:26:25 +0100 Message-ID: <20260416232625.26758-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.53.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" The cam tool is our swiss army knife for interogating libcamera. A frequently needed piece of information is to determine what version of libcamera is installed or being run on a system. This information is available in the debug logs of libcamera when a CameraManager is instantiated. However without actually starting the CameraManager this information is not presented. Add an option to 'cam' to allow it to report the version. Whilst this is the version from the 'cam' command, it directly gets the version of the libcamera library to which cam is linked. Signed-off-by: Kieran Bingham --- Quite simply: kbingham@charm:~/iob/libcamera$ ./build/gcc/src/apps/cam/cam --version libcamera version v0.7.0+89-ed4dd6bb-dirty (2026-04-17T00:18:37BST) and kbingham@charm:~/iob/libcamera$ ./build/gcc/src/apps/cam/cam --help Options: -c, --camera camera ... Specify which camera to operate on, by id or by index -h, --help Display this help message -v, --version Display libcamera version information -I, --info Display information about stream(s) .... ... src/apps/cam/main.cpp | 8 ++++++++ src/apps/cam/main.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/apps/cam/main.cpp b/src/apps/cam/main.cpp index 029f518f7294..120917eb632d 100644 --- a/src/apps/cam/main.cpp +++ b/src/apps/cam/main.cpp @@ -126,6 +126,8 @@ int CamApp::parseOptions(int argc, char *argv[]) ArgumentRequired, "camera", true); parser.addOption(OptHelp, OptionNone, "Display this help message", "help"); + parser.addOption(OptVersion, OptionNone, "Display libcamera version information", + "version"); parser.addOption(OptInfo, OptionNone, "Display information about stream(s)", "info"); parser.addOption(OptList, OptionNone, "List all cameras", "list"); @@ -197,6 +199,12 @@ int CamApp::parseOptions(int argc, char *argv[]) return options_.empty() ? -EINVAL : -EINTR; } + if (options_.isSet(OptVersion)) { + const std::string &version = CameraManager::version(); + std::cout << "libcamera version " << version << std::endl; + return -EINTR; + } + return 0; } diff --git a/src/apps/cam/main.h b/src/apps/cam/main.h index 64e6a20e8668..9bec1e712dfb 100644 --- a/src/apps/cam/main.h +++ b/src/apps/cam/main.h @@ -20,6 +20,7 @@ enum { OptOrientation = 'o', OptSDL = 'S', OptStream = 's', + OptVersion = 'v', OptListControls = 256, OptStrictFormats = 257, OptMetadata = 258,