|
|
86f512 |
From b6276ef70616c326b02c6798b9e3824b42c2f83b Mon Sep 17 00:00:00 2001
|
|
|
86f512 |
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
|
|
86f512 |
Date: Wed, 29 Jan 2020 17:27:42 +0100
|
|
|
86f512 |
Subject: [PATCH 84/86] v4l2: always decode VIDIOC_*_EXT_CTRLS ioctl commands
|
|
|
86f512 |
|
|
|
86f512 |
* v4l2.c (struct_v4l2_area, struct_v4l2_ext_control,
|
|
|
86f512 |
struct_v4l2_ext_controls): New type definitions.
|
|
|
86f512 |
(print_v4l2_ext_control, print_v4l2_ext_controls): Do not guard with
|
|
|
86f512 |
VIDIOC_S_EXT_CTRLS anymore.
|
|
|
86f512 |
(v4l2_ioctl)
|
|
|
86f512 |
VIDIOC_G_EXT_CTRLS>: Likewise.
|
|
|
86f512 |
(print_v4l2_ext_control): Do not guard size and string field printing
|
|
|
86f512 |
with HAVE_STRUCT_V4L2_EXT_CONTROL_STRING.
|
|
|
86f512 |
---
|
|
|
86f512 |
v4l2.c | 50 ++++++++++++++++++++++++++++++++++++++++----------
|
|
|
86f512 |
1 file changed, 40 insertions(+), 10 deletions(-)
|
|
|
86f512 |
|
|
|
86f512 |
diff --git a/v4l2.c b/v4l2.c
|
|
|
86f512 |
index d2b80e4..6240337 100644
|
|
|
86f512 |
--- a/v4l2.c
|
|
|
86f512 |
+++ b/v4l2.c
|
|
|
86f512 |
@@ -220,8 +220,42 @@ CHECK_V4L2_STRUCT_RESERVED_SIZE(v4l2_create_buffers);
|
|
|
86f512 |
#endif
|
|
|
86f512 |
|
|
|
86f512 |
|
|
|
86f512 |
-typedef struct v4l2_ext_control struct_v4l2_ext_control;
|
|
|
86f512 |
-typedef struct v4l2_ext_controls struct_v4l2_ext_controls;
|
|
|
86f512 |
+/** Added by Linux v5.5-rc1~143^2^2~225 */
|
|
|
86f512 |
+typedef struct {
|
|
|
86f512 |
+ __u32 width;
|
|
|
86f512 |
+ __u32 height;
|
|
|
86f512 |
+} struct_v4l2_area;
|
|
|
86f512 |
+
|
|
|
86f512 |
+/** Added by Linux commit v2.6.18-rc1~862^2~18 */
|
|
|
86f512 |
+typedef struct {
|
|
|
86f512 |
+ uint32_t id;
|
|
|
86f512 |
+ uint32_t size; /* Added by v2.6.32-rc1~679^2~72 */
|
|
|
86f512 |
+ uint32_t reserved2[1];
|
|
|
86f512 |
+ union {
|
|
|
86f512 |
+ int32_t value;
|
|
|
86f512 |
+ int64_t value64;
|
|
|
86f512 |
+ char *string; /**< Added by v2.6.32-rc1~679^2~72 */
|
|
|
86f512 |
+ uint8_t *p_u8; /**< Added by v3.17-rc1~112^2~343 */
|
|
|
86f512 |
+ uint16_t *p_u16; /**< Added by v3.17-rc1~112^2~343 */
|
|
|
86f512 |
+ uint32_t *p_u32; /**< Added by v3.17-rc1~112^2~112 */
|
|
|
86f512 |
+ struct_v4l2_area *p_area; /**< Added by v5.5-rc1~143^2^2~51 */
|
|
|
86f512 |
+ void *ptr; /**< Added by v3.17-rc1~112^2~363 */
|
|
|
86f512 |
+ };
|
|
|
86f512 |
+} ATTRIBUTE_PACKED struct_v4l2_ext_control;
|
|
|
86f512 |
+
|
|
|
86f512 |
+/** Added by Linux commit v2.6.18-rc1~862^2~18 */
|
|
|
86f512 |
+typedef struct {
|
|
|
86f512 |
+ union {
|
|
|
86f512 |
+ uint32_t ctrl_class;
|
|
|
86f512 |
+ uint32_t which;
|
|
|
86f512 |
+ };
|
|
|
86f512 |
+ uint32_t count;
|
|
|
86f512 |
+ uint32_t error_idx;
|
|
|
86f512 |
+ int32_t request_fd; /**< Added by Linux commit v4.20-rc1~51^2~44 */
|
|
|
86f512 |
+ uint32_t reserved[1];
|
|
|
86f512 |
+ struct_v4l2_ext_control *controls;
|
|
|
86f512 |
+} struct_v4l2_ext_controls;
|
|
|
86f512 |
+
|
|
|
86f512 |
typedef struct v4l2_framebuffer struct_v4l2_framebuffer;
|
|
|
86f512 |
typedef struct v4l2_input struct_v4l2_input;
|
|
|
86f512 |
typedef struct v4l2_standard struct_v4l2_standard;
|
|
|
86f512 |
@@ -974,7 +1008,6 @@ print_v4l2_crop(struct tcb *const tcp, const kernel_ulong_t arg,
|
|
|
86f512 |
return RVAL_IOCTL_DECODED;
|
|
|
86f512 |
}
|
|
|
86f512 |
|
|
|
86f512 |
-#ifdef VIDIOC_S_EXT_CTRLS
|
|
|
86f512 |
static bool
|
|
|
86f512 |
print_v4l2_ext_control(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
|
|
|
86f512 |
{
|
|
|
86f512 |
@@ -982,14 +1015,14 @@ print_v4l2_ext_control(struct tcb *tcp, void *elem_buf, size_t elem_size, void *
|
|
|
86f512 |
|
|
|
86f512 |
tprints("{id=");
|
|
|
86f512 |
printxval(v4l2_control_ids, p->id, "V4L2_CID_???");
|
|
|
86f512 |
-# if HAVE_STRUCT_V4L2_EXT_CONTROL_STRING
|
|
|
86f512 |
tprintf(", size=%u", p->size);
|
|
|
86f512 |
if (p->size > 0) {
|
|
|
86f512 |
tprints(", string=");
|
|
|
86f512 |
printstrn(tcp, ptr_to_kulong(p->string), p->size);
|
|
|
86f512 |
- } else
|
|
|
86f512 |
-# endif
|
|
|
86f512 |
- tprintf(", value=%d, value64=%" PRId64, p->value, (int64_t) p->value64);
|
|
|
86f512 |
+ } else {
|
|
|
86f512 |
+ tprintf(", value=%d, value64=%" PRId64,
|
|
|
86f512 |
+ p->value, (int64_t) p->value64);
|
|
|
86f512 |
+ }
|
|
|
86f512 |
tprints("}");
|
|
|
86f512 |
|
|
|
86f512 |
return true;
|
|
|
86f512 |
@@ -1042,7 +1075,6 @@ print_v4l2_ext_controls(struct tcb *const tcp, const kernel_ulong_t arg,
|
|
|
86f512 |
/* entering */
|
|
|
86f512 |
return 0;
|
|
|
86f512 |
}
|
|
|
86f512 |
-#endif /* VIDIOC_S_EXT_CTRLS */
|
|
|
86f512 |
|
|
|
86f512 |
#ifdef VIDIOC_ENUM_FRAMESIZES
|
|
|
86f512 |
# include "xlat/v4l2_framesize_types.h"
|
|
|
86f512 |
@@ -1243,13 +1275,11 @@ MPERS_PRINTER_DECL(int, v4l2_ioctl, struct tcb *const tcp,
|
|
|
86f512 |
case VIDIOC_S_CROP: /* W */
|
|
|
86f512 |
return print_v4l2_crop(tcp, arg, code == VIDIOC_G_CROP);
|
|
|
86f512 |
|
|
|
86f512 |
-#ifdef VIDIOC_S_EXT_CTRLS
|
|
|
86f512 |
case VIDIOC_S_EXT_CTRLS: /* RW */
|
|
|
86f512 |
case VIDIOC_TRY_EXT_CTRLS: /* RW */
|
|
|
86f512 |
case VIDIOC_G_EXT_CTRLS: /* RW */
|
|
|
86f512 |
return print_v4l2_ext_controls(tcp, arg,
|
|
|
86f512 |
code == VIDIOC_G_EXT_CTRLS);
|
|
|
86f512 |
-#endif /* VIDIOC_S_EXT_CTRLS */
|
|
|
86f512 |
|
|
|
86f512 |
#ifdef VIDIOC_ENUM_FRAMESIZES
|
|
|
86f512 |
case VIDIOC_ENUM_FRAMESIZES: /* RW */
|
|
|
86f512 |
--
|
|
|
86f512 |
2.1.4
|
|
|
86f512 |
|