@@ -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;
}
@@ -20,6 +20,7 @@ enum {
OptOrientation = 'o',
OptSDL = 'S',
OptStream = 's',
+ OptVersion = 'v',
OptListControls = 256,
OptStrictFormats = 257,
OptMetadata = 258,
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 <kieran.bingham@ideasonboard.com> --- 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) .... <snip remaining usage help> ... src/apps/cam/main.cpp | 8 ++++++++ src/apps/cam/main.h | 1 + 2 files changed, 9 insertions(+)