Message ID | 20200710131813.452513-1-paul.elder@ideasonboard.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Received: from mail.kernel.org ([198.145.29.99]) by www.linuxtv.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <SRS0=OMbO=AV=xs4all.nl=hverkuil@kernel.org>) id 1jtu8n-009WQj-Gw for patchwork@linuxtv.org; Fri, 10 Jul 2020 14:36:49 +0000 Received: from coco.lan (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E074F20748 for <patchwork@linuxtv.org>; Fri, 10 Jul 2020 14:41:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Hb+lr/3G"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="W1dHCIAB" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=List-ID:Sender: Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Resent-Message-ID:Resent-Date:Resent-To:Resent-From:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=/UrkFsf7eE1JiGtJReWU2ROr+6/VJPEHe3Lf7sRPiVg=; b=Hb+lr/3GwqFEnfEAslFWZEQEYW EIjIhVN4AAUL9aFDK+JFZ2G6ASj3/BJaNSJpbQ7ps6Tj/TTJ/wT56XSYUZhl1uSHcIwwmpBrx13Pc zSppWEJs1DLeLULl2Yphunz89sCV7wJnWXejJok6WVO7tnweKxkOqDTVQqf3TnFjwklBXu97ak1vN v4h6cviqW3G/QZDo7wh8qIXxpdQW9qQ8d5uhD0qDGIVGy30CQhNQsHEWsEt4/s908l2AP0oTvPYM/ PHvrny0D07td4XXM7hP9KEFLr/FlDcNv7SLaEUZLprAm1bB6vE7SjA+4WL+FekhLVmWNS1MDr0iWH 2LEVyvJA==; DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 565EF20748 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=hverkuil@xs4all.nl Resent-From: Hans Verkuil <hverkuil@xs4all.nl> Resent-To: Mauro Carvalho Chehab <mchehab@kernel.org> Resent-Date: Fri, 10 Jul 2020 16:08:21 +0200 Resent-Message-ID: <def01967-5d7f-a7c0-31d5-c2b3ea1a9e03@xs4all.nl> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1594387105; bh=+KyvSVBa7+z478OUpLaw+u5yAAnb2o19VHjDBJdnG+0=; h=From:To:Cc:Subject:Date:From; b=W1dHCIAB9dneC8jHv9dlrfuV8vgDFUWTuQXuNPAxQ2uanrE3OMaUtEbklDUGeVq21 Y6T7ImHz43h+nyWgx4q+puf+JDCdFLTTEq6Iet/2+MrEkw6aUOz6mRlt+IUD1h6joN J4/DhLVQsarnMUZnrkJrRhu4MXDpsaZIgfGpmAxs= From: Paul Elder <paul.elder@ideasonboard.com> (by way of Mauro Carvalho Chehab <mchehab@kernel.org>) To: linux-media@vger.kernel.org Cc: Paul Elder <paul.elder@ideasonboard.com>, laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl Date: Fri, 10 Jul 2020 22:18:12 +0900 Message-Id: <20200710131813.452513-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-CNFS-Analysis: v=2.3 cv=FZSsOK26 c=1 sm=0 tr=0 cx=a_idp_e a=z+VJRr5mNHYewdIGeBCeeQ==:117 a=z+VJRr5mNHYewdIGeBCeeQ==:17 a=xqWC_Br6kY4A:10 a=_RQrkK6FrEwA:10 a=P1BnusSwAAAA:8 a=MmvTgjvw4tz-2tuqK4EA:9 a=D0XLA9XvdZm18NrgonBM:22 X-Virus-Scanned: by XS4ALL Virus Scanner X-CMAE-Envelope: MS4wfE5FoaMem3m06OvFhMpqYADMu3U+YpIu2IEQJKhpFcS9dYB8bfS8MbHX3svU2sdN+ib6YGmL41+EOc95FHG0TSZKCaIq5PwQtyREIbyZGxX/b6fSF9ZX JaUc7kTWojYDqPQk6UfZc3Y4wfgcYNavrkZ5aJpM7Ik/8n6W9POOlE6y X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_100826_453341_CA78E3F1 X-CRM114-Status: GOOD ( 11.68 ) X-Spam-Score: -5.9 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Resent-Date: Fri, 10 Jul 2020 16:41:22 +0200 Resent-From: Mauro Carvalho Chehab <mchehab@kernel.org> Subject: [PATCH 1/2] v4l2-compliance: Add version command Resent-Message-ID: <20200710164122.558a207b@coco.lan> Resent-To: patchwork@linuxtv.org X-LSpam-Score: -7.3 (-------) X-LSpam-Report: No, score=-7.3 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_HI=-5,T_DKIM_INVALID=0.01 autolearn=unavailable autolearn_force=no |
Series |
[1/2] v4l2-compliance: Add version command
|
|
Commit Message
Paul Elder
July 10, 2020, 1:18 p.m. UTC
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(+)
Comments
Hi Paul, Thank you for the patch. On Fri, Jul 10, 2020 at 10:18:12PM +0900, Paul Elder wrote: > 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"); Is it enough to rely on the v4l-utils package version, or should we add a git commit count as well ? The traditional version number will make it difficult to test for features added between two released versions. > +} > + > 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]);
On 10/07/2020 15:25, Laurent Pinchart wrote: > Hi Paul, > > Thank you for the patch. > > On Fri, Jul 10, 2020 at 10:18:12PM +0900, Paul Elder wrote: >> 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"); > > Is it enough to rely on the v4l-utils package version, or should we add > a git commit count as well ? The traditional version number will make it > difficult to test for features added between two released versions. If you add a version option, then v4l2-compliance should also show the SHA. It's already available (grep for SHA), so easy enough to add here. Also, if you add --version here, then it really should be added to most other utils as well (certainly media-ctl and cec-follower/ctl/compliance). Regards, Hans > >> +} >> + >> 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]); >
On Fri, Jul 10, 2020 at 03:33:25PM +0200, Hans Verkuil wrote: > On 10/07/2020 15:25, Laurent Pinchart wrote: > > Hi Paul, > > > > Thank you for the patch. > > > > On Fri, Jul 10, 2020 at 10:18:12PM +0900, Paul Elder wrote: > >> 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"); > > > > Is it enough to rely on the v4l-utils package version, or should we add > > a git commit count as well ? The traditional version number will make it > > difficult to test for features added between two released versions. Yeah, it might be useful. > If you add a version option, then v4l2-compliance should also show the SHA. > It's already available (grep for SHA), so easy enough to add here. Oh yeah we could use that. > Also, if you add --version here, then it really should be added to most > other utils as well (certainly media-ctl and cec-follower/ctl/compliance). Okay, I can add that. For v4l2-ctl and the other tools, would it be better like: v4l2-ctl 1.21.0-deadbeef Or like what v4l2-compliance has: v4l2-compliance SHA: 3b22ab02b960e4d1e90618e9fce9b7c8a80d814a, 64 bits, 64-bit time_t v4l2-compliance 1.21.0 Thanks, Paul > >> +} > >> + > >> 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]); > > >
On 10/07/2020 15:44, paul.elder@ideasonboard.com wrote: > On Fri, Jul 10, 2020 at 03:33:25PM +0200, Hans Verkuil wrote: >> On 10/07/2020 15:25, Laurent Pinchart wrote: >>> Hi Paul, >>> >>> Thank you for the patch. >>> >>> On Fri, Jul 10, 2020 at 10:18:12PM +0900, Paul Elder wrote: >>>> 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"); >>> >>> Is it enough to rely on the v4l-utils package version, or should we add >>> a git commit count as well ? The traditional version number will make it >>> difficult to test for features added between two released versions. > > Yeah, it might be useful. > >> If you add a version option, then v4l2-compliance should also show the SHA. >> It's already available (grep for SHA), so easy enough to add here. > > Oh yeah we could use that. > >> Also, if you add --version here, then it really should be added to most >> other utils as well (certainly media-ctl and cec-follower/ctl/compliance). > > Okay, I can add that. > > For v4l2-ctl and the other tools, would it be better like: > > v4l2-ctl 1.21.0-deadbeef > > Or like what v4l2-compliance has: > > v4l2-compliance SHA: 3b22ab02b960e4d1e90618e9fce9b7c8a80d814a, 64 bits, 64-bit time_t > > v4l2-compliance 1.21.0 The SHA is only necessary for the compliance tests (v4l2/cec-compliance). It's not needed for the others. The PACKAGE_VERSION is fine for non-compliance utilities. For v4l2/cec-compliance I would like to see this output: v4l2-compliance 1.21.0 v4l2-compliance SHA: 3b22ab02b960e4d1e90618e9fce9b7c8a80d814a, 64 bits, 64-bit time_t cec-compliance 1.21.0 cec-compliance SHA: 3b22ab02b960e4d1e90618e9fce9b7c8a80d814a The SHA may not be available, in that case show "not available". Regards, Hans > > > > > > Thanks, > > Paul > >>>> +} >>>> + >>>> 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]); >>> >>
Hi Hans, On Fri, Jul 10, 2020 at 03:33:25PM +0200, Hans Verkuil wrote: > On 10/07/2020 15:25, Laurent Pinchart wrote: > > On Fri, Jul 10, 2020 at 10:18:12PM +0900, Paul Elder wrote: > >> 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"); > > > > Is it enough to rely on the v4l-utils package version, or should we add > > a git commit count as well ? The traditional version number will make it > > difficult to test for features added between two released versions. > > If you add a version option, then v4l2-compliance should also show the SHA. > It's already available (grep for SHA), so easy enough to add here. The issue with the SHA is that, while it identifies the exact commit, it is useless to compare versions. We are using v4l2-compliance to test the libcamera V4L2 compatibility layer, and this depends on recent features merged in the master branch but not available in a release yet. We would like the test to be skipped if the v4l2-compliance is too old. Printing the package version is a good step forward, but would require waiting for the next release before the test can be enabled. That's probably OK overall, but it's a bit annoying during development. That's why I was wondering if a commit count (as output by git rev-list --count HEAD) would be useful too. In our case, the fact that v4l2-compliance supports the --version option will be enough to know it's recent enough, but I'm thinking about the future (for libcamera and other users). > Also, if you add --version here, then it really should be added to most > other utils as well (certainly media-ctl and cec-follower/ctl/compliance). > > >> +} > >> + > >> 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]);
On 10/07/2020 15:51, Laurent Pinchart wrote: > Hi Hans, > > On Fri, Jul 10, 2020 at 03:33:25PM +0200, Hans Verkuil wrote: >> On 10/07/2020 15:25, Laurent Pinchart wrote: >>> On Fri, Jul 10, 2020 at 10:18:12PM +0900, Paul Elder wrote: >>>> 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"); >>> >>> Is it enough to rely on the v4l-utils package version, or should we add >>> a git commit count as well ? The traditional version number will make it >>> difficult to test for features added between two released versions. >> >> If you add a version option, then v4l2-compliance should also show the SHA. >> It's already available (grep for SHA), so easy enough to add here. > > The issue with the SHA is that, while it identifies the exact commit, it > is useless to compare versions. We are using v4l2-compliance to test the > libcamera V4L2 compatibility layer, and this depends on recent features > merged in the master branch but not available in a release yet. We would > like the test to be skipped if the v4l2-compliance is too old. Printing > the package version is a good step forward, but would require waiting > for the next release before the test can be enabled. That's probably OK > overall, but it's a bit annoying during development. That's why I was > wondering if a commit count (as output by git rev-list --count HEAD) > would be useful too. In our case, the fact that v4l2-compliance supports > the --version option will be enough to know it's recent enough, but I'm > thinking about the future (for libcamera and other users). That would work, then you would get this: v4l2-compliance 1.21.0-4606 v4l2-compliance SHA: 3b22ab02b960e4d1e90618e9fce9b7c8a80d814a, 64 bits, 64-bit time_t cec-compliance 1.21.0-4604 cec-compliance SHA: 3b22ab02b960e4d1e90618e9fce9b7c8a80d814a I still want the SHA, though :-) The problem with the commit count is that someone can fork v4l-utils and apply its own patches. So the count does not sufficiently identify the version. It's no doubt fine for libcamera, but for getting a new driver into mainline I must know the exact version that is used for the compliance test. Regards, Hans > >> Also, if you add --version here, then it really should be added to most >> other utils as well (certainly media-ctl and cec-follower/ctl/compliance). >> >>>> +} >>>> + >>>> 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]); >
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]);