From c04dd1ccf463ccd56ea1273e137206d2988d4acb Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Fri, 1 Nov 2019 02:09:03 +0100
Subject: [PATCH 80/82] v4l2: provide struct v4l2_capability definition
* v4l2.c (struct_v4l2_capability): New typedef.
[HAVE_STRUCT_V4L2_CAPABILITY]: Check struct v4l2_capability
with CHECK_V4L2_STRUCT_RESERVED_SIZE.
(print_v4l2_capability): Change type of caps variable
to struct_v4l2_capability; drop HAVE_STRUCT_V4L2_CAPABILITY_DEVICE_CAPS
guarg; print device_caps field only if it's non-zero.
---
v4l2.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/v4l2.c b/v4l2.c
index 85c667d..292ebae 100644
--- a/v4l2.c
+++ b/v4l2.c
@@ -46,6 +46,19 @@
typedef struct v4l2_buffer struct_v4l2_buffer;
typedef struct v4l2_clip struct_v4l2_clip;
+
+typedef struct {
+ uint8_t driver[16];
+ uint8_t card[32];
+ uint8_t bus_info[32];
+ uint32_t version;
+ uint32_t capabilities;
+ uint32_t device_caps; /**< Added by v3.4-rc1~110^2^2~259 */
+ uint32_t reserved[3];
+} struct_v4l2_capability;
+CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_capability);
+
+
typedef struct {
uint32_t index;
uint32_t count;
@@ -146,7 +159,7 @@ print_pixelformat(uint32_t fourcc, const struct xlat *xlat)
static int
print_v4l2_capability(struct tcb *const tcp, const kernel_ulong_t arg)
{
- struct v4l2_capability caps;
+ struct_v4l2_capability caps;
if (entering(tcp))
return 0;
@@ -162,11 +175,11 @@ print_v4l2_capability(struct tcb *const tcp, const kernel_ulong_t arg)
caps.version & 0xFF);
printflags(v4l2_device_capabilities_flags, caps.capabilities,
"V4L2_CAP_???");
-#ifdef HAVE_STRUCT_V4L2_CAPABILITY_DEVICE_CAPS
- tprints(", device_caps=");
- printflags(v4l2_device_capabilities_flags, caps.device_caps,
- "V4L2_CAP_???");
-#endif
+ if (caps.device_caps) {
+ tprints(", device_caps=");
+ printflags(v4l2_device_capabilities_flags, caps.device_caps,
+ "V4L2_CAP_???");
+ }
tprints("}");
return RVAL_IOCTL_DECODED;
}
--
2.1.4