Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH 1/2] v4l2-compliance: Add version command
@ 2020-07-10 13:18 Paul Elder
  2020-07-10 13:18 ` [PATCH 2/2] v4l2-ctl: " Paul Elder
  2020-07-10 13:25 ` [PATCH 1/2] v4l2-compliance: " Laurent Pinchart
  0 siblings, 2 replies; 8+ messages in thread
From: Paul Elder @ 2020-07-10 13:18 UTC (permalink / raw)
  To: linux-media; +Cc: Paul Elder, laurent.pinchart, hverkuil

Add a --version option to v4l2-compliance to retrieve the version of
v4l2-compliance.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 utils/v4l2-compliance/v4l2-compliance.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 4b45f110..72b9768f 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -79,6 +79,7 @@ enum Option {
 	OptMediaBusInfo = 'z',
 	OptStreamFrom = 128,
 	OptStreamFromHdr,
+	OptVersion,
 	OptLast = 256
 };
 
@@ -153,9 +154,15 @@ static struct option long_options[] = {
 	{"stream-all-formats", optional_argument, 0, OptStreamAllFormats},
 	{"stream-all-io", no_argument, 0, OptStreamAllIO},
 	{"stream-all-color", required_argument, 0, OptStreamAllColorTest},
+	{"version", no_argument, 0, OptVersion},
 	{0, 0, 0, 0}
 };
 
+static void version()
+{
+	printf("v4l2-compliance " PACKAGE_VERSION "\n");
+}
+
 static void usage()
 {
 	printf("Usage:\n");
@@ -244,6 +251,7 @@ static void usage()
 	printf("  -P, --no-progress  Turn off progress messages.\n");
 	printf("  -T, --trace        Trace all called ioctls.\n");
 	printf("  -v, --verbose      Turn on verbose reporting.\n");
+	printf("  --version          Show version information.\n");
 #ifndef NO_LIBV4L2
 	printf("  -w, --wrapper      Use the libv4l2 wrapper library.\n");
 #endif
@@ -1664,6 +1672,9 @@ int main(int argc, char **argv)
 		case OptNoProgress:
 			no_progress = true;
 			break;
+		case OptVersion:
+			version();
+			std::exit(EXIT_SUCCESS);
 		case ':':
 			fprintf(stderr, "Option `%s' requires a value\n",
 				argv[optind]);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-07-10 14:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-10 13:18 [PATCH 1/2] v4l2-compliance: Add version command Paul Elder
2020-07-10 13:18 ` [PATCH 2/2] v4l2-ctl: " Paul Elder
2020-07-10 13:25 ` [PATCH 1/2] v4l2-compliance: " Laurent Pinchart
2020-07-10 13:33   ` Hans Verkuil
2020-07-10 13:44     ` paul.elder
2020-07-10 13:50       ` Hans Verkuil
2020-07-10 13:51     ` Laurent Pinchart
2020-07-10 14:03       ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox