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;
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++) {
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;
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;
}
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;
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;
}
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;
}