summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/videodev.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-06-25 08:54:05 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2008-06-25 08:54:05 +0200
commit27e82989174b7c0e74f8af1b7de360c0017530d3 (patch)
treef3dc862830ec94ffcababa57ba33ab201f49c804 /linux/drivers/media/video/videodev.c
parentd85faf11b1d744c74c448af9265e260d65aa5f56 (diff)
downloadmediapointer-dvb-s2-27e82989174b7c0e74f8af1b7de360c0017530d3.tar.gz
mediapointer-dvb-s2-27e82989174b7c0e74f8af1b7de360c0017530d3.tar.bz2
videodev: allow PRIVATE_BASE controls when called through VIDIOC_G/S_CTRL.
From: Hans Verkuil <hverkuil@xs4all.nl> V4L2_CID_PRIVATE_BASE controls are not allowed when called from VIDIOC_S/G_EXT_CTRL as extended controls use a better mechanism for private controls. But still allow it when called from the VIDIOC_G/S_CTRL to extended control conversion in video_ioctl2() for backwards compatibility. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/videodev.c')
-rw-r--r--linux/drivers/media/video/videodev.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c
index e54016432..cfe8b2a79 100644
--- a/linux/drivers/media/video/videodev.c
+++ b/linux/drivers/media/video/videodev.c
@@ -748,7 +748,7 @@ static inline void v4l_print_ext_ctrls(unsigned int cmd,
printk(KERN_CONT "\n");
};
-static inline int check_ext_ctrls(struct v4l2_ext_controls *c)
+static inline int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
{
__u32 i;
@@ -759,8 +759,11 @@ static inline int check_ext_ctrls(struct v4l2_ext_controls *c)
c->controls[i].reserved2[1] = 0;
}
/* V4L2_CID_PRIVATE_BASE cannot be used as control class
- * when using extended controls. */
- if (c->ctrl_class == V4L2_CID_PRIVATE_BASE)
+ when using extended controls.
+ Only when passed in through VIDIOC_G_CTRL and VIDIOC_S_CTRL
+ is it allowed for backwards compatibility.
+ */
+ if (!allow_priv && c->ctrl_class == V4L2_CID_PRIVATE_BASE)
return 0;
/* Check that all controls are from the same control class. */
for (i = 0; i < c->count; i++) {
@@ -1464,7 +1467,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ctrls.controls = &ctrl;
ctrl.id = p->id;
ctrl.value = p->value;
- if (check_ext_ctrls(&ctrls)) {
+ if (check_ext_ctrls(&ctrls, 1)) {
ret = vfd->vidioc_g_ext_ctrls(file, fh, &ctrls);
if (ret == 0)
p->value = ctrl.value;
@@ -1500,7 +1503,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ctrls.controls = &ctrl;
ctrl.id = p->id;
ctrl.value = p->value;
- if (check_ext_ctrls(&ctrls))
+ if (check_ext_ctrls(&ctrls, 1))
ret = vfd->vidioc_s_ext_ctrls(file, fh, &ctrls);
break;
}
@@ -1511,7 +1514,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
p->error_idx = p->count;
if (!vfd->vidioc_g_ext_ctrls)
break;
- if (check_ext_ctrls(p))
+ if (check_ext_ctrls(p, 0))
ret = vfd->vidioc_g_ext_ctrls(file, fh, p);
v4l_print_ext_ctrls(cmd, vfd, p, !ret);
break;
@@ -1524,7 +1527,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
if (!vfd->vidioc_s_ext_ctrls)
break;
v4l_print_ext_ctrls(cmd, vfd, p, 1);
- if (check_ext_ctrls(p))
+ if (check_ext_ctrls(p, 0))
ret = vfd->vidioc_s_ext_ctrls(file, fh, p);
break;
}
@@ -1536,7 +1539,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
if (!vfd->vidioc_try_ext_ctrls)
break;
v4l_print_ext_ctrls(cmd, vfd, p, 1);
- if (check_ext_ctrls(p))
+ if (check_ext_ctrls(p, 0))
ret = vfd->vidioc_try_ext_ctrls(file, fh, p);
break;
}