Hi Paul, Thank you for the patch. On Sat, Jul 11, 2020 at 12:28:54AM +0900, Paul Elder wrote: > Add a --version option to v4l2-ctl to retrieve the version of v4l2-ctl. > > Signed-off-by: Paul Elder <paul.elder@xxxxxxxxxxxxxxxx> > --- > utils/v4l2-ctl/v4l2-ctl-common.cpp | 1 + > utils/v4l2-ctl/v4l2-ctl.cpp | 9 +++++++++ > utils/v4l2-ctl/v4l2-ctl.h | 1 + > 3 files changed, 11 insertions(+) > > diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp > index 47f5da1a..9b785cbf 100644 > --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp > +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp > @@ -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" > ); > } > > diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp > index 4972591e..bc7330c4 100644 > --- a/utils/v4l2-ctl/v4l2-ctl.cpp > +++ b/utils/v4l2-ctl/v4l2-ctl.cpp > @@ -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,11 @@ static void usage_all() > edid_usage(); > } > > +static void version() > +{ > + printf("v4l2-ctl " PACKAGE_VERSION "\n"); I'd write printf("v4l2-ctl %s\n", PACKAGE_VERSION); in case PACKAGE_VERSION would get a % in the future. Same for the other patches in this series. Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > +} > + > int test_ioctl(int fd, unsigned long cmd, void *arg) > { > return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg); > @@ -1245,6 +1251,9 @@ int main(int argc, char **argv) > case OptSleep: > secs = strtoul(optarg, 0L, 0); > break; > + case OptVersion: > + version(); > + return 0; > case ':': > fprintf(stderr, "Option '%s' requires a value\n", > argv[optind]); > diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h > index 28e50471..27a3ca35 100644 > --- a/utils/v4l2-ctl/v4l2-ctl.h > +++ b/utils/v4l2-ctl/v4l2-ctl.h > @@ -263,6 +263,7 @@ enum Option { > OptHelpStreaming, > OptHelpEdid, > OptHelpAll, > + OptVersion, > OptLast = 512 > }; > -- Regards, Laurent Pinchart