v4l2-compliance: Add version command
PATCH v5 1/5 v4l2-compliance: Add version command
Add a --version option to v4l2-compliance to retrieve the version of v4l2-compliance. While at it, factor out and reorder printing the SHA to after argument parsing.
---
Changes in v5:
- update manpage
- move STR macros to before print_sha()
Changes in v4:
- add git commit count to version
Changes in v3:
- embed PACKAGE_VERSION instead of string concatenation
--- utils/v4l2-compliance/v4l2-compliance.1.in | 3 +++ utils/v4l2-compliance/v4l2-compliance.cpp | 31 +++++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-)
utils/v4l2-compliance/v4l2-compliance.1.in +3 -0
@@ -184,6 +184,9 @@ Trace all called ioctls. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wrapper\fR Use the libv4l2 wrapper library for all V4L2 device accesses. Note that doing this will cause some tests to fail because the libv4l2 library isn't fully V4L2 compliant. By
utils/v4l2-compliance/v4l2-compliance.cpp +25 -6
@@ -76,6 +76,7 @@ enum Option { OptMediaBusInfo = 'z', OptStreamFrom = 128, OptStreamFromHdr, + OptVersion, OptLast = 256 };
@@ -150,9 +151,25 @@ 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} }; +#define STR(x) #x +#define STRING(x) STR(x) + +static void print_sha() +{ + printf("v4l2-compliance SHA: %s", STRING(GIT_SHA)); + printf(", %zd bits, %zd-bit time_t\n", sizeof(void *) * 8, sizeof(time_t) * 8); + printf("\n"); +} + +static void print_version() +{ + printf("v4l2-compliance %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage() { printf("Usage:\n");
@@ -241,6 +258,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
@@ -1482,12 +1500,6 @@ int main(int argc, char **argv) char *value, *subs; int idx = 0; -#define STR(x) #x -#define STRING(x) STR(x) - printf("v4l2-compliance SHA: %s", STRING(GIT_SHA)); - printf(", %zd bits, %zd-bit time_t\n", sizeof(void *) * 8, sizeof(time_t) * 8); - printf("\n"); - if (!env_media_apps_color || !strcmp(env_media_apps_color, "auto")) show_colors = isatty(STDOUT_FILENO); else if (!strcmp(env_media_apps_color, "always"))
@@ -1656,6 +1668,10 @@ int main(int argc, char **argv) case OptNoProgress: no_progress = true; break; + case OptVersion: + print_version(); + print_sha(); + std::exit(EXIT_SUCCESS); case ':': fprintf(stderr, "Option `%s' requires a value\n", argv[optind]);
@@ -1677,6 +1693,9 @@ int main(int argc, char **argv) usage(); std::exit(EXIT_FAILURE); } + + print_sha(); + bool direct = !options[OptUseWrapper]; int fd;
Signature · 1 line
2.27.0
PATCH v5 2/5 v4l2-ctl: Add version command
Add a --version option to v4l2-ctl to retrieve the version of v4l2-ctl.
---
Changes in v5:
- update manpage
Changes in v4:
- add git commit count to version
Changes in v3:
- embed PACKAGE_VERSION instead of string concatenation
--- utils/v4l2-ctl/Makefile.am | 2 +- utils/v4l2-ctl/v4l2-ctl-common.cpp | 1 + utils/v4l2-ctl/v4l2-ctl.1.in | 3 +++ utils/v4l2-ctl/v4l2-ctl.cpp | 11 +++++++++++ utils/v4l2-ctl/v4l2-ctl.h | 1 + 5 files changed, 17 insertions(+), 1 deletion(-)
utils/v4l2-ctl/Makefile.am +1 -1
@@ -14,7 +14,7 @@ v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cp v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp v4l2-ctl-modes.cpp \ v4l2-ctl-subdev.cpp v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c v4l2-ctl-meta.cpp \ media-info.cpp v4l2-info.cpp codec-fwht.c codec-v4l2-fwht.c -v4l2_ctl_CPPFLAGS = -I$(top_srcdir)/utils/common +v4l2_ctl_CPPFLAGS = -I$(top_srcdir)/utils/common $(GIT_COMMIT_CNT) media-bus-format-names.h: $(top_srcdir)/include/linux/media-bus-format.h sed -e '/#define MEDIA_BUS_FMT/ ! d; s/.*FMT_//; /FIXED/ d; s/\t.*//; s/.*/{ \"&\", MEDIA_BUS_FMT_& },/;' \
utils/v4l2-ctl/v4l2-ctl-common.cpp +1 -0
@@ -121,6 +121,7 @@ void common_usage() " --silent only set the result code, do not print any messages\n" " --sleep <secs> sleep <secs>, call QUERYCAP and close the file handle\n" " --verbose turn on verbose ioctl status reporting\n" + " --version show version information\n" ); }
utils/v4l2-ctl/v4l2-ctl.1.in +3 -0
@@ -21,6 +21,9 @@ with the bus info string as specified by the \fB-z\fR option. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wrapper\fR Use the libv4l2 wrapper library for all V4L2 device accesses. By default v4l2-ctl will directly access the V4L2 device, but with this option all access will go via this
utils/v4l2-ctl/v4l2-ctl.cpp +11 -0
@@ -284,6 +284,7 @@ static struct option long_options[] = { {"stream-out-user", optional_argument, 0, OptStreamOutUser}, {"stream-out-dmabuf", no_argument, 0, OptStreamOutDmaBuf}, {"list-patterns", no_argument, 0, OptListPatterns}, + {"version", no_argument, 0, OptVersion}, {0, 0, 0, 0} };
@@ -306,6 +307,13 @@ static void usage_all() edid_usage(); } +static void print_version() +{ +#define STR(x) #x +#define STRING(x) STR(x) + printf("v4l2-ctl %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + int test_ioctl(int fd, unsigned long cmd, void *arg) { return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg);
@@ -1245,6 +1253,9 @@ int main(int argc, char **argv) case OptSleep: secs = strtoul(optarg, 0L, 0); break; + case OptVersion: + print_version(); + return 0; case ':': fprintf(stderr, "Option '%s' requires a value\n", argv[optind]);
utils/v4l2-ctl/v4l2-ctl.h +1 -0
@@ -263,6 +263,7 @@ enum Option { OptHelpStreaming, OptHelpEdid, OptHelpAll, + OptVersion, OptLast = 512 };
Signature · 1 line
2.27.0
PATCH v5 3/5 cec-compliance: Add version command
In reply to Paul ElderAdd a --version option to cec-compliance to retrieve the version of cec-compliance. While at it, factor out printing the SHA.
---
Changes in v5:
- update manpage
- move STR macros to before print_sha()
Changes in v4:
- add git commit count to version
Changes in v3:
- embed PACKAGE_VERSION instead of string concatenation
--- utils/cec-compliance/Makefile.am | 2 +- utils/cec-compliance/cec-compliance.1.in | 3 +++ utils/cec-compliance/cec-compliance.cpp | 25 +++++++++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-)
utils/cec-compliance/Makefile.am +1 -1
@@ -2,7 +2,7 @@ bin_PROGRAMS = cec-compliance man_MANS = cec-compliance.1 cec_compliance_SOURCES = cec-compliance.cpp cec-compliance.h cec-test.cpp cec-test-adapter.cpp cec-test-audio.cpp cec-test-power.cpp cec-test-fuzzing.cpp -cec_compliance_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) +cec_compliance_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT) cec_compliance_LDADD = -lrt ../libcecutil/libcecutil.la EXTRA_DIST = cec-compliance.1
utils/cec-compliance/cec-compliance.1.in +3 -0
@@ -119,6 +119,9 @@ check that the test produced no warnings. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wall\-clock\fR Show timestamps as wall-clock time. This also turns on verbose reporting. .TP
utils/cec-compliance/cec-compliance.cpp +22 -3
@@ -93,6 +93,8 @@ enum Option { OptSkipTestTunerControl, OptSkipTestVendorSpecificCommands, OptSkipTestStandbyResume, + + OptVersion, OptLast = 256 };
@@ -174,9 +176,23 @@ static struct option long_options[] = { {"skip-test-tuner-control", no_argument, 0, OptSkipTestTunerControl}, {"skip-test-vendor-specific-commands", no_argument, 0, OptSkipTestVendorSpecificCommands}, {"skip-test-standby-resume", no_argument, 0, OptSkipTestStandbyResume}, + {"version", no_argument, 0, OptVersion}, {0, 0, 0, 0} }; +#define STR(x) #x +#define STRING(x) STR(x) + +static void print_sha() +{ + printf("cec-compliance SHA : %s\n", STRING(GIT_SHA)); +} + +static void print_version() +{ + printf("cec-compliance %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage() { printf("Usage:\n"
@@ -231,6 +247,7 @@ static void usage() " -s, --skip-info Skip Driver Info output\n" " -T, --trace Trace all called ioctls\n" " -v, --verbose Turn on verbose reporting\n" + " --version Show version information\n" " -w, --wall-clock Show timestamps as wall-clock time (implies -v)\n" " -W, --exit-on-warn Exit on the first warning.\n" );
@@ -1258,6 +1275,10 @@ int main(int argc, char **argv) case OptVerbose: show_info = true; break; + case OptVersion: + print_version(); + print_sha(); + std::exit(EXIT_SUCCESS); case ':': fprintf(stderr, "Option '%s' requires a value\n", argv[optind]);
@@ -1392,9 +1413,7 @@ int main(int argc, char **argv) if (options[OptInteractive]) test_tags |= TAG_INTERACTIVE; -#define STR(x) #x -#define STRING(x) STR(x) - printf("cec-compliance SHA : %s\n", STRING(GIT_SHA)); + print_sha(); node.phys_addr = CEC_PHYS_ADDR_INVALID; doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &node.phys_addr);
Signature · 1 line
2.27.0
PATCH v5 4/5 cec-ctl: Add version command
In reply to Paul ElderAdd a --version option to cec-ctl to retrieve the version of cec-ctl.
---
Changes in v5:
- update manpage
Changes in v4:
- add git commit count to version
Changes in v3:
- embed PACKAGE_VERSION instead of string concatenation
--- utils/cec-ctl/Makefile.am | 2 +- utils/cec-ctl/cec-ctl.1.in | 3 +++ utils/cec-ctl/cec-ctl.cpp | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-)
utils/cec-ctl/Makefile.am +1 -1
@@ -2,7 +2,7 @@ bin_PROGRAMS = cec-ctl man_MANS = cec-ctl.1 cec_ctl_SOURCES = cec-ctl.cpp cec-pin.cpp cec-ctl.h -cec_ctl_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil +cec_ctl_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_COMMIT_CNT) cec_ctl_LDADD = -lrt ../libcecutil/libcecutil.la EXTRA_DIST = cec-ctl.1
utils/cec-ctl/cec-ctl.1.in +3 -0
@@ -52,6 +52,9 @@ having to rely on the device node number. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wall\-clock\fR Show timestamps as wall-clock time. This also turns on verbose reporting. .TP
utils/cec-ctl/cec-ctl.cpp +15 -0
@@ -133,6 +133,7 @@ enum Option { OptVendorCommandWithID, OptVendorRemoteButtonDown, OptCustomCommand, + OptVersion, }; struct node {
@@ -218,6 +219,8 @@ static struct option long_options[] = { { "unregistered", no_argument, 0, OptUnregistered }, { "help-all", no_argument, 0, OptHelpAll }, + { "version", no_argument, 0, OptVersion }, + CEC_PARSE_LONG_OPTS { "vendor-remote-button-down", required_argument, 0, OptVendorRemoteButtonDown }, \
@@ -231,6 +234,13 @@ static struct option long_options[] = { { 0, 0, 0, 0 } }; +static void print_version() +{ +#define STR(x) #x +#define STRING(x) STR(x) + printf("cec-ctl %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage() { printf("Usage:\n"
@@ -262,6 +272,7 @@ static void usage() " --help-all Show all help messages\n" " -T, --trace Trace all called ioctls\n" " -v, --verbose Turn on verbose reporting\n" + " --version Show version information\n" " -w, --wall-clock Show timestamps as wall-clock time (implies -v)\n" " -W, --wait-for-msgs Wait for messages and events for up to --monitor-time secs.\n" " --cec-version-1.4 Use CEC Version 1.4 instead of 2.0\n"
@@ -2296,6 +2307,10 @@ int main(int argc, char **argv) break; } + case OptVersion: + print_version(); + std::exit(EXIT_SUCCESS); + default: if (ch >= OptHelpAll) { cec_parse_usage_options(options);
Signature · 1 line
2.27.0
PATCH v5 5/5 cec-follower: Add version command
In reply to Paul ElderAdd a --version option to cec-follower to retrieve the version of cec-follower. Whilte at it, factor out printing the SHA.
---
Changes in v5:
- update manpage
Changes in v4:
- add git commit count to version
- move printing sha into print_sha()
Changes in v3:
- embed PACKAGE_VERSION instead of string concatenation
--- utils/cec-follower/Makefile.am | 2 +- utils/cec-follower/cec-follower.1.in | 3 +++ utils/cec-follower/cec-follower.cpp | 30 +++++++++++++++++++++------- 3 files changed, 27 insertions(+), 8 deletions(-)
utils/cec-follower/Makefile.am +1 -1
@@ -2,7 +2,7 @@ bin_PROGRAMS = cec-follower man_MANS = cec-follower.1 cec_follower_SOURCES = cec-follower.cpp cec-follower.h cec-processing.cpp cec-tuner.cpp -cec_follower_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil +cec_follower_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_COMMIT_CNT) cec_follower_LDADD = -lrt ../libcecutil/libcecutil.la cec-follower.cpp: version.h
utils/cec-follower/cec-follower.1.in +3 -0
@@ -61,6 +61,9 @@ having to rely on the device node number. \fB\-v\fR, \fB\-\-verbose\fR Turn on verbose reporting. .TP +\fB\-\-version\fR +Show version information. +.TP \fB\-w\fR, \fB\-\-wall\-clock\fR Show timestamps as wall-clock time. This also turns on verbose reporting. .TP
utils/cec-follower/cec-follower.cpp +23 -7
@@ -46,6 +46,7 @@ enum Option { OptShowState = 's', OptWallClock = 'w', OptServiceByDigID = 128, + OptVersion, OptLast = 256 };
@@ -70,10 +71,27 @@ static struct option long_options[] = { { "wall-clock", no_argument, 0, OptWallClock }, { "service-by-dig-id", no_argument, 0, OptServiceByDigID }, { "ignore", required_argument, 0, OptIgnore }, + { "version", no_argument, 0, OptVersion }, { 0, 0, 0, 0 } }; +static void print_sha() +{ +#ifdef SHA +#define STR(x) #x +#define STRING(x) STR(x) + printf("cec-follower SHA : %s\n", STRING(SHA)); +#else + printf("cec-follower SHA : not available\n"); +#endif +} + +static void print_version() +{ + printf("cec-follower %s%s\n", PACKAGE_VERSION, STRING(GIT_COMMIT_CNT)); +} + static void usage() { printf("Usage:\n"
@@ -93,6 +111,7 @@ static void usage() " Ignore messages from logical address <la> and opcode\n" " <opcode>. 'all' can be used for <la> or <opcode> to match\n" " all logical addresses or opcodes.\n" + " --version Show version information\n" ); }
@@ -427,6 +446,9 @@ int main(int argc, char **argv) show_msgs = true; show_state = true; break; + case OptVersion: + print_version(); + std::exit(EXIT_SUCCESS); case ':': fprintf(stderr, "Option '%s' requires a value\n", argv[optind]);
@@ -475,13 +497,7 @@ int main(int argc, char **argv) node.state.service_by_dig_id = options[OptServiceByDigID]; state_init(node); -#ifdef SHA -#define STR(x) #x -#define STRING(x) STR(x) - printf("cec-follower SHA : %s\n", STRING(SHA)); -#else - printf("cec-follower SHA : not available\n"); -#endif + print_sha(); doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &node.phys_addr);
Signature · 1 line
2.27.0