diff mbox series

[1/1] package/eudev: fix compile-time issue on very old kernels

Message ID 20230405173410.158297-1-stefan@ott.net
State Changes Requested
Headers show
Series [1/1] package/eudev: fix compile-time issue on very old kernels | expand

Commit Message

Stefan Ott April 5, 2023, 5:34 p.m. UTC
Kernel versions prior to 3.4 did not have V4L2_CAP_DEVICE_CAPS and
compiling against such a kernel will fail.

This patch introduces a version check and makes eudev fall back to
v2cap.capabilities on these kernels.

Signed-off-by: Stefan Ott <stefan@ott.net>
---
 ...mpile-time-issue-on-very-old-kernels.patch | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch

Comments

Arnout Vandecappelle April 9, 2023, 2:18 p.m. UTC | #1
On 05/04/2023 19:34, Stefan Ott via buildroot wrote:
> Kernel versions prior to 3.4 did not have V4L2_CAP_DEVICE_CAPS and

  It's kernel *headers*, not kernel. This got me confused for a moment, I 
thought there was a problem when trying to build on a system with a very old 
running kernel...

> compiling against such a kernel will fail.
> 
> This patch introduces a version check and makes eudev fall back to
> v2cap.capabilities on these kernels.
> 
> Signed-off-by: Stefan Ott <stefan@ott.net>
> ---
>   ...mpile-time-issue-on-very-old-kernels.patch | 29 +++++++++++++++++++
>   1 file changed, 29 insertions(+)
>   create mode 100644 package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch
> 
> diff --git a/package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch b/package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch
> new file mode 100644
> index 0000000000..63546079d6
> --- /dev/null
> +++ b/package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch
> @@ -0,0 +1,29 @@
> +Fix compile-time issue on very old kernels

  Please use git-formatted patches, especially sine the upstream repository is 
git [1].

> +
> +Kernel versions prior to 3.4 did not have V4L2_CAP_DEVICE_CAPS and
> +compiling eudev against such a kernel will fail.
> +
> +This patch introduces a version check and makes eudev fall back to
> +v2cap.capabilities on these kernels.
> +

Add a Signed-off-by line for yourself.  This is a short way for you to
assert that you are entitled to contribute the patch under the relevant license 
(in this case, eudev's LGPL2.1+).  See [2] for more details.

  Also, there should be an upstream reference, i.e. something like:

Upstream: https://github.com/eudev-project/eudev/pulls/...

(of course, you should first create a pull request :-)

  Since the Signed-off-by is absolutely essential, I've marked your patch as 
Changes Requested.

  Regards,
  Arnout

[1] https://github.com/eudev-project/eudev
[2] http://elinux.org/Developer_Certificate_Of_Origin

> +diff -Naur a/src/v4l_id/v4l_id.c b/src/v4l_id/v4l_id.c
> +@@ -28,7 +28,6 @@
> + #include <sys/types.h>
> + #include <sys/time.h>
> + #include <sys/ioctl.h>
> +-#include <linux/version.h>
> + #include <linux/videodev2.h>
> +
> + #include "util.h"
> +@@ -72,11 +71,9 @@
> +                 printf("ID_V4L_VERSION=2\n");
> +                 printf("ID_V4L_PRODUCT=%s\n", v2cap.card);
> +                 printf("ID_V4L_CAPABILITIES=:");
> +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
> +                 if (v2cap.capabilities & V4L2_CAP_DEVICE_CAPS)
> +                         capabilities = v2cap.device_caps;
> +                 else
> +-#endif
> +                         capabilities = v2cap.capabilities;
> +                 if ((capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0 ||
> +                     (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) > 0)
diff mbox series

Patch

diff --git a/package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch b/package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch
new file mode 100644
index 0000000000..63546079d6
--- /dev/null
+++ b/package/eudev/0002-Fix-compile-time-issue-on-very-old-kernels.patch
@@ -0,0 +1,29 @@ 
+Fix compile-time issue on very old kernels
+
+Kernel versions prior to 3.4 did not have V4L2_CAP_DEVICE_CAPS and
+compiling eudev against such a kernel will fail.
+
+This patch introduces a version check and makes eudev fall back to
+v2cap.capabilities on these kernels.
+
+diff -Naur a/src/v4l_id/v4l_id.c b/src/v4l_id/v4l_id.c
+@@ -28,7 +28,6 @@
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/ioctl.h>
+-#include <linux/version.h>
+ #include <linux/videodev2.h>
+ 
+ #include "util.h"
+@@ -72,11 +71,9 @@
+                 printf("ID_V4L_VERSION=2\n");
+                 printf("ID_V4L_PRODUCT=%s\n", v2cap.card);
+                 printf("ID_V4L_CAPABILITIES=:");
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
+                 if (v2cap.capabilities & V4L2_CAP_DEVICE_CAPS)
+                         capabilities = v2cap.device_caps;
+                 else
+-#endif
+                         capabilities = v2cap.capabilities;
+                 if ((capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0 ||
+                     (capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) > 0)