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

* [PATCH 2/2] v4l2-ctl: Add version command
  2020-07-10 13:18 [PATCH 1/2] v4l2-compliance: Add version command Paul Elder
@ 2020-07-10 13:18 ` Paul Elder
  2020-07-10 13:25 ` [PATCH 1/2] v4l2-compliance: " Laurent Pinchart
  1 sibling, 0 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-ctl to retrieve the version of v4l2-ctl.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 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");
+}
+
 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
 };
 
-- 
2.27.0


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

* Re: [PATCH 1/2] v4l2-compliance: Add version command
  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 ` Laurent Pinchart
  2020-07-10 13:33   ` Hans Verkuil
  1 sibling, 1 reply; 8+ messages in thread
From: Laurent Pinchart @ 2020-07-10 13:25 UTC (permalink / raw)
  To: Paul Elder; +Cc: linux-media, hverkuil

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]);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 1/2] v4l2-compliance: Add version command
  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:51     ` Laurent Pinchart
  0 siblings, 2 replies; 8+ messages in thread
From: Hans Verkuil @ 2020-07-10 13:33 UTC (permalink / raw)
  To: Laurent Pinchart, Paul Elder; +Cc: linux-media

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]);
> 


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

* Re: [PATCH 1/2] v4l2-compliance: Add version command
  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
  1 sibling, 1 reply; 8+ messages in thread
From: paul.elder @ 2020-07-10 13:44 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Laurent Pinchart, linux-media

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]);
> > 
> 

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

* Re: [PATCH 1/2] v4l2-compliance: Add version command
  2020-07-10 13:44     ` paul.elder
@ 2020-07-10 13:50       ` Hans Verkuil
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2020-07-10 13:50 UTC (permalink / raw)
  To: paul.elder; +Cc: Laurent Pinchart, linux-media

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]);
>>>
>>


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

* Re: [PATCH 1/2] v4l2-compliance: Add version command
  2020-07-10 13:33   ` Hans Verkuil
  2020-07-10 13:44     ` paul.elder
@ 2020-07-10 13:51     ` Laurent Pinchart
  2020-07-10 14:03       ` Hans Verkuil
  1 sibling, 1 reply; 8+ messages in thread
From: Laurent Pinchart @ 2020-07-10 13:51 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Paul Elder, linux-media

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]);

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 1/2] v4l2-compliance: Add version command
  2020-07-10 13:51     ` Laurent Pinchart
@ 2020-07-10 14:03       ` Hans Verkuil
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2020-07-10 14:03 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Paul Elder, linux-media

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]);
> 


^ permalink raw reply	[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