media: videodev2.h: add request_fd field to v4l2_ext_controls
authorAlexandre Courbot <acourbot@chromium.org>
Mon, 21 May 2018 08:54:35 +0000 (04:54 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 31 Aug 2018 15:08:55 +0000 (11:08 -0400)
If 'which' is V4L2_CTRL_WHICH_REQUEST_VAL, then the 'request_fd' field
can be used to specify a request for the G/S/TRY_EXT_CTRLS ioctls.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-compat-ioctl32.c
drivers/media/v4l2-core/v4l2-ioctl.c
include/uapi/linux/videodev2.h

index 6481212fda772c734e0c2222dde8611932cbdaf1..dcce86c1fe40d9d2681b9509139f622cf35c3ba0 100644 (file)
@@ -834,7 +834,8 @@ struct v4l2_ext_controls32 {
        __u32 which;
        __u32 count;
        __u32 error_idx;
-       __u32 reserved[2];
+       __s32 request_fd;
+       __u32 reserved[1];
        compat_caddr_t controls; /* actually struct v4l2_ext_control32 * */
 };
 
@@ -909,6 +910,7 @@ static int get_v4l2_ext_controls32(struct file *file,
            get_user(count, &p32->count) ||
            put_user(count, &p64->count) ||
            assign_in_user(&p64->error_idx, &p32->error_idx) ||
+           assign_in_user(&p64->request_fd, &p32->request_fd) ||
            copy_in_user(p64->reserved, p32->reserved, sizeof(p64->reserved)))
                return -EFAULT;
 
@@ -974,6 +976,7 @@ static int put_v4l2_ext_controls32(struct file *file,
            get_user(count, &p64->count) ||
            put_user(count, &p32->count) ||
            assign_in_user(&p32->error_idx, &p64->error_idx) ||
+           assign_in_user(&p32->request_fd, &p64->request_fd) ||
            copy_in_user(p32->reserved, p64->reserved, sizeof(p32->reserved)) ||
            get_user(kcontrols, &p64->controls))
                return -EFAULT;
index ea475d833dd6b1f97627c9cbcf60af7c22f4683b..03241d6b7ef8955367704dad8174494b092ea21c 100644 (file)
@@ -590,8 +590,8 @@ static void v4l_print_ext_controls(const void *arg, bool write_only)
        const struct v4l2_ext_controls *p = arg;
        int i;
 
-       pr_cont("which=0x%x, count=%d, error_idx=%d",
-                       p->which, p->count, p->error_idx);
+       pr_cont("which=0x%x, count=%d, error_idx=%d, request_fd=%d",
+                       p->which, p->count, p->error_idx, p->request_fd);
        for (i = 0; i < p->count; i++) {
                if (!p->controls[i].size)
                        pr_cont(", id/val=0x%x/0x%x",
@@ -907,7 +907,7 @@ static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
        __u32 i;
 
        /* zero the reserved fields */
-       c->reserved[0] = c->reserved[1] = 0;
+       c->reserved[0] = 0;
        for (i = 0; i < c->count; i++)
                c->controls[i].reserved2[0] = 0;
 
index 622f0479d668752653a14e7b1962b1690c75f783..ec62d376ba6140ddf2522001ee975963b6e49fe0 100644 (file)
@@ -1606,7 +1606,8 @@ struct v4l2_ext_controls {
        };
        __u32 count;
        __u32 error_idx;
-       __u32 reserved[2];
+       __s32 request_fd;
+       __u32 reserved[1];
        struct v4l2_ext_control *controls;
 };
 
@@ -1619,6 +1620,7 @@ struct v4l2_ext_controls {
 #define V4L2_CTRL_MAX_DIMS       (4)
 #define V4L2_CTRL_WHICH_CUR_VAL   0
 #define V4L2_CTRL_WHICH_DEF_VAL   0x0f000000
+#define V4L2_CTRL_WHICH_REQUEST_VAL 0x0f010000
 
 enum v4l2_ctrl_type {
        V4L2_CTRL_TYPE_INTEGER       = 1,