diff options
author | Eugene Syromyatnikov <evgsyr@gmail.com> | 2019-11-01 02:09:03 +0100 |
---|---|---|
committer | Eugene Syromyatnikov <evgsyr@gmail.com> | 2020-03-30 23:14:23 +0200 |
commit | 7cc5f8266b78673dde1874faec15419077355f48 (patch) | |
tree | 68380449b60622702f8f22abefc008630d3fca16 | |
parent | c9efac31da0ec11ad368f21c59021eafe653cfe1 (diff) | |
download | strace-7cc5f8266b78673dde1874faec15419077355f48.tar.gz |
v4l2: provide struct v4l2_capability definition
* types/v4l2.h (struct_v4l2_capability): New typedef.
* v4l2.c: 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
guard; print device_caps field only if it's non-zero.
References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201
-rw-r--r-- | tests/ioctl_v4l2-success.c | 4 | ||||
-rw-r--r-- | types/v4l2.h | 12 | ||||
-rw-r--r-- | v4l2.c | 13 | ||||
-rw-r--r-- | xlat/v4l2_ioctl_cmds.in | 2 |
4 files changed, 22 insertions, 9 deletions
diff --git a/tests/ioctl_v4l2-success.c b/tests/ioctl_v4l2-success.c index 0e2db849c..bfad88794 100644 --- a/tests/ioctl_v4l2-success.c +++ b/tests/ioctl_v4l2-success.c @@ -317,6 +317,8 @@ main(int argc, char **argv) caps->capabilities = 0xdeadbeef; #ifdef HAVE_STRUCT_V4L2_CAPABILITY_DEVICE_CAPS caps->device_caps = 0xfacefeed; +#else + caps->reserved[0] = 0xfacefeed; #endif ioctl(-1, VIDIOC_QUERYCAP, 0); @@ -351,7 +353,6 @@ main(int argc, char **argv) "|V4L2_CAP_EXT_PIX_FORMAT|V4L2_CAP_META_CAPTURE|V4L2_CAP_ASYNCIO" "|V4L2_CAP_STREAMING|V4L2_CAP_META_OUTPUT|V4L2_CAP_TOUCH" "|V4L2_CAP_DEVICE_CAPS|0x40000008")); -#ifdef HAVE_STRUCT_V4L2_CAPABILITY_DEVICE_CAPS printf(", device_caps=" XLAT_KNOWN(0xfacefeed, "V4L2_CAP_VIDEO_CAPTURE|V4L2_CAP_VIDEO_OVERLAY" "|V4L2_CAP_VBI_OUTPUT|V4L2_CAP_SLICED_VBI_CAPTURE" @@ -362,7 +363,6 @@ main(int argc, char **argv) "|V4L2_CAP_RADIO|V4L2_CAP_MODULATOR|V4L2_CAP_SDR_OUTPUT" "|V4L2_CAP_META_CAPTURE|V4L2_CAP_ASYNCIO|V4L2_CAP_META_OUTPUT" "|V4L2_CAP_TOUCH|V4L2_CAP_DEVICE_CAPS|0x60000008")); -#endif printf("}) = %ld (INJECTED)\n", inject_retval); diff --git a/types/v4l2.h b/types/v4l2.h index c814a14f4..eeeddfae8 100644 --- a/types/v4l2.h +++ b/types/v4l2.h @@ -24,6 +24,18 @@ typedef struct v4l2_framebuffer struct_v4l2_framebuffer; typedef struct v4l2_input struct_v4l2_input; typedef struct v4l2_standard struct_v4l2_standard; + +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; + + typedef struct { uint32_t index; uint32_t count; @@ -40,6 +40,7 @@ #include "types/v4l2.h" +CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_capability); #ifdef HAVE_STRUCT_V4L2_CREATE_BUFFERS CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_create_buffers); #endif @@ -131,7 +132,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; @@ -146,11 +147,11 @@ print_v4l2_capability(struct tcb *const tcp, const kernel_ulong_t arg) tprints(", capabilities="); 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; } diff --git a/xlat/v4l2_ioctl_cmds.in b/xlat/v4l2_ioctl_cmds.in index 22f274e83..11cfc5734 100644 --- a/xlat/v4l2_ioctl_cmds.in +++ b/xlat/v4l2_ioctl_cmds.in @@ -1,4 +1,4 @@ -VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability) +VIDIOC_QUERYCAP _IOR ('V', 0, struct_v4l2_capability) VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) VIDIOC_G_FMT _IOWR('V', 4, struct_v4l2_format) VIDIOC_S_FMT _IOWR('V', 5, struct_v4l2_format) |