[libcamera-devel] meson: detect kernel version

Message ID 20200611084329.4648-1-scerveau@collabora.com
State Superseded
Headers show
Series
  • [libcamera-devel] meson: detect kernel version
Related show

Commit Message

Stéphane Cerveau June 11, 2020, 8:43 a.m. UTC
Add kernel version detection to warn user
that only >= 5.0.0 V4L API are supported in
libcamera.

Signed-off-by: Stéphane Cerveau <scerveau@collabora.com>
---
 meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Kieran Bingham June 11, 2020, 9:09 a.m. UTC | #1
Hi Stéphane,

On 11/06/2020 09:43, Stéphane Cerveau wrote:
> Add kernel version detection to warn user
> that only >= 5.0.0 V4L API are supported in
> libcamera.
> 
> Signed-off-by: Stéphane Cerveau <scerveau@collabora.com>
> ---
>  meson.build | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index e898782..a72fef6 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -105,6 +105,14 @@ if get_option('test')
>      subdir('test')
>  endif
>  
> +if not meson.is_cross_build()
> +  kernel_version_req = '>= 5.0.0'
> +  kernel_version = run_command('uname', '-r').stdout()

> meson.build:112: WARNING: V4L2 API version 5.4.0-33-generic
>  is too old, >= 5.8.0 is required, consider to upgrade your kernel version to use libcamera

This needs a .strip() at the end to remove the new lines:

> +  if not kernel_version.version_compare(kernel_version_req)
> +    warning('V4L2 API version @0@ is too old, @1@ is required, consider to upgrade your kernel version to use 
libcamera'.format(kernel_version, kernel_version_req))

That line is really long, can it be reduced? At the very least, the
.format() can move to a new line I believe.


Grammatically I think this should be :
 "consider upgrading your"
rather than
 "consider to upgrade"

but that's longer ;-(


"WARNING: V4L2 API version 5.4.0-33-generic"

That's not really the V4L2 API version (I mean I guess it is) but it's
the Linux-kernel version...

So I wouldn't reference the V4L2 API there ...


> +  endif
> +endif
> +
>  # Create a symlink from the build root to the source root. This is used when
>  # running libcamera from the build directory to locate resources in the source
>  # directory (such as IPA configuration files).
>
Stéphane Cerveau June 11, 2020, 9:32 a.m. UTC | #2
Hi Kieran,

Thank you for your feedback.
I updated the message to be shorter and more explicit (I hope).

Concerning V4L2 message, yes that's the original issue I was facing :) 
Not understand what I neeed to do fix this error:

V4L2 API v4.15.18 too old, v5.0.0 or later

Maybe we should fix this message too :)

Stéphane.

On 11/6/20 11:09, Kieran Bingham wrote:
> Hi Stéphane,
> 
> On 11/06/2020 09:43, Stéphane Cerveau wrote:
>> Add kernel version detection to warn user
>> that only >= 5.0.0 V4L API are supported in
>> libcamera.
>>
>> Signed-off-by: Stéphane Cerveau <scerveau@collabora.com>
>> ---
>>   meson.build | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/meson.build b/meson.build
>> index e898782..a72fef6 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -105,6 +105,14 @@ if get_option('test')
>>       subdir('test')
>>   endif
>>   
>> +if not meson.is_cross_build()
>> +  kernel_version_req = '>= 5.0.0'
>> +  kernel_version = run_command('uname', '-r').stdout()
> 
>> meson.build:112: WARNING: V4L2 API version 5.4.0-33-generic
>>   is too old, >= 5.8.0 is required, consider to upgrade your kernel version to use libcamera
> 
> This needs a .strip() at the end to remove the new lines:
> 
>> +  if not kernel_version.version_compare(kernel_version_req)
>> +    warning('V4L2 API version @0@ is too old, @1@ is required, consider to upgrade your kernel version to use
> libcamera'.format(kernel_version, kernel_version_req))
> 
> That line is really long, can it be reduced? At the very least, the
> .format() can move to a new line I believe.
> 
> 
> Grammatically I think this should be :
>   "consider upgrading your"
> rather than
>   "consider to upgrade"
> 
> but that's longer ;-(
> 
> 
> "WARNING: V4L2 API version 5.4.0-33-generic"
> 
> That's not really the V4L2 API version (I mean I guess it is) but it's
> the Linux-kernel version...
> 
> So I wouldn't reference the V4L2 API there ...
> 
> 
>> +  endif
>> +endif
>> +
>>   # Create a symlink from the build root to the source root. This is used when
>>   # running libcamera from the build directory to locate resources in the source
>>   # directory (such as IPA configuration files).
>>
>
Kieran Bingham June 11, 2020, 9:53 a.m. UTC | #3
Hi Stéphane

On 11/06/2020 10:32, scerveau wrote:
> Hi Kieran,
> 
> Thank you for your feedback.
> I updated the message to be shorter and more explicit (I hope).
> 
> Concerning V4L2 message, yes that's the original issue I was facing :)
> Not understand what I neeed to do fix this error:
> 
> V4L2 API v4.15.18 too old, v5.0.0 or later
> 
> Maybe we should fix this message too :)

Aha - so the V4L2VideoDevice already does the check. I see. And that
will indeed prevent pipelines from being created.

Below I think I was really just being pedantic about the message
printed, as it is the kernel version not a 'v4l2 api' version (though
those are the same thing ultimately).


> 
> Stéphane.
> 
> On 11/6/20 11:09, Kieran Bingham wrote:
>> Hi Stéphane,
>>
>> On 11/06/2020 09:43, Stéphane Cerveau wrote:
>>> Add kernel version detection to warn user
>>> that only >= 5.0.0 V4L API are supported in
>>> libcamera.
>>>
>>> Signed-off-by: Stéphane Cerveau <scerveau@collabora.com>
>>> ---
>>>   meson.build | 8 ++++++++
>>>   1 file changed, 8 insertions(+)
>>>
>>> diff --git a/meson.build b/meson.build
>>> index e898782..a72fef6 100644
>>> --- a/meson.build
>>> +++ b/meson.build
>>> @@ -105,6 +105,14 @@ if get_option('test')
>>>       subdir('test')
>>>   endif
>>>   +if not meson.is_cross_build()
>>> +  kernel_version_req = '>= 5.0.0'
>>> +  kernel_version = run_command('uname', '-r').stdout()
>>
>>> meson.build:112: WARNING: V4L2 API version 5.4.0-33-generic
>>>   is too old, >= 5.8.0 is required, consider to upgrade your kernel
>>> version to use libcamera
>>
>> This needs a .strip() at the end to remove the new lines:
>>
>>> +  if not kernel_version.version_compare(kernel_version_req)
>>> +    warning('V4L2 API version @0@ is too old, @1@ is required,
>>> consider to upgrade your kernel version to use
>> libcamera'.format(kernel_version, kernel_version_req))
>>
>> That line is really long, can it be reduced? At the very least, the
>> .format() can move to a new line I believe.
>>
>>
>> Grammatically I think this should be :
>>   "consider upgrading your"
>> rather than
>>   "consider to upgrade"
>>
>> but that's longer ;-(
>>
>>
>> "WARNING: V4L2 API version 5.4.0-33-generic"
>>
>> That's not really the V4L2 API version (I mean I guess it is) but it's
>> the Linux-kernel version...
>>
>> So I wouldn't reference the V4L2 API there ...
>>
>>
>>> +  endif
>>> +endif
>>> +
>>>   # Create a symlink from the build root to the source root. This is
>>> used when
>>>   # running libcamera from the build directory to locate resources in
>>> the source
>>>   # directory (such as IPA configuration files).
>>>
>>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Stéphane Cerveau June 11, 2020, 10:05 a.m. UTC | #4
Hi Kieran,


On 11/6/20 11:53, Kieran Bingham wrote:
> Hi Stéphane
> 
> On 11/06/2020 10:32, scerveau wrote:
>> Hi Kieran,
>>
>> Thank you for your feedback.
>> I updated the message to be shorter and more explicit (I hope).
>>
>> Concerning V4L2 message, yes that's the original issue I was facing :)
>> Not understand what I neeed to do fix this error:
>>
>> V4L2 API v4.15.18 too old, v5.0.0 or later
>>
>> Maybe we should fix this message too :)
> 
Yes but the message is not very obvious as it can be confusing with v4L
library version, dont you think ?

> Aha - so the V4L2VideoDevice already does the check. I see. And that
> will indeed prevent pipelines from being created.
> 
> Below I think I was really just being pedantic about the message
> printed, as it is the kernel version not a 'v4l2 api' version (though
> those are the same thing ultimately).
> 
> 
>>
>> Stéphane.
>>
>> On 11/6/20 11:09, Kieran Bingham wrote:
>>> Hi Stéphane,
>>>
>>> On 11/06/2020 09:43, Stéphane Cerveau wrote:
>>>> Add kernel version detection to warn user
>>>> that only >= 5.0.0 V4L API are supported in
>>>> libcamera.
>>>>
>>>> Signed-off-by: Stéphane Cerveau <scerveau@collabora.com>
>>>> ---
>>>>    meson.build | 8 ++++++++
>>>>    1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/meson.build b/meson.build
>>>> index e898782..a72fef6 100644
>>>> --- a/meson.build
>>>> +++ b/meson.build
>>>> @@ -105,6 +105,14 @@ if get_option('test')
>>>>        subdir('test')
>>>>    endif
>>>>    +if not meson.is_cross_build()
>>>> +  kernel_version_req = '>= 5.0.0'
>>>> +  kernel_version = run_command('uname', '-r').stdout()
>>>
>>>> meson.build:112: WARNING: V4L2 API version 5.4.0-33-generic
>>>>    is too old, >= 5.8.0 is required, consider to upgrade your kernel
>>>> version to use libcamera
>>>
>>> This needs a .strip() at the end to remove the new lines:
>>>
>>>> +  if not kernel_version.version_compare(kernel_version_req)
>>>> +    warning('V4L2 API version @0@ is too old, @1@ is required,
>>>> consider to upgrade your kernel version to use
>>> libcamera'.format(kernel_version, kernel_version_req))
>>>
>>> That line is really long, can it be reduced? At the very least, the
>>> .format() can move to a new line I believe.
>>>
>>>
>>> Grammatically I think this should be :
>>>    "consider upgrading your"
>>> rather than
>>>    "consider to upgrade"
>>>
>>> but that's longer ;-(
>>>
>>>
>>> "WARNING: V4L2 API version 5.4.0-33-generic"
>>>
>>> That's not really the V4L2 API version (I mean I guess it is) but it's
>>> the Linux-kernel version...
>>>
>>> So I wouldn't reference the V4L2 API there ...
>>>
>>>
>>>> +  endif
>>>> +endif
>>>> +
>>>>    # Create a symlink from the build root to the source root. This is
>>>> used when
>>>>    # running libcamera from the build directory to locate resources in
>>>> the source
>>>>    # directory (such as IPA configuration files).
>>>>
>>>
>> _______________________________________________
>> libcamera-devel mailing list
>> libcamera-devel@lists.libcamera.org
>> https://lists.libcamera.org/listinfo/libcamera-devel
>

Patch

diff --git a/meson.build b/meson.build
index e898782..a72fef6 100644
--- a/meson.build
+++ b/meson.build
@@ -105,6 +105,14 @@  if get_option('test')
     subdir('test')
 endif
 
+if not meson.is_cross_build()
+  kernel_version_req = '>= 5.0.0'
+  kernel_version = run_command('uname', '-r').stdout()
+  if not kernel_version.version_compare(kernel_version_req)
+    warning('V4L2 API version @0@ is too old, @1@ is required, consider to upgrade your kernel version to use libcamera'.format(kernel_version, kernel_version_req))
+  endif
+endif
+
 # Create a symlink from the build root to the source root. This is used when
 # running libcamera from the build directory to locate resources in the source
 # directory (such as IPA configuration files).