Skip to contentSkip to conversation

v4l2-ctrls: allow HIDDEN controls in the user class

PATCH Hans Verkuil 2 participants 2 messages Feb 15, 2014 – Mar 4, 2014 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Previously hidden controls were not allowed in the user class due to backwards compatibility reasons (QUERYCTRL should not see them), but by simply testing if QUERYCTRL found a hidden control and returning -EINVAL this limitation can be lifted.

---
 drivers/media/v4l2-core/v4l2-ctrls.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/media/v4l2-core/v4l2-ctrls.c +3 -9
index bc30c50..859ac29 100644
@@ -1853,15 +1853,6 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
 	/* Complex controls are always hidden */
 	if (is_matrix || type >= V4L2_CTRL_COMPLEX_TYPES)
 		flags |= V4L2_CTRL_FLAG_HIDDEN;
-	/*
-	 * No hidden controls are allowed in the USER class
-	 * due to backwards compatibility with old applications.
-	 */
-	if (V4L2_CTRL_ID2CLASS(id) == V4L2_CTRL_CLASS_USER &&
-	    (flags & V4L2_CTRL_FLAG_HIDDEN)) {
-		handler_set_err(hdl, -EINVAL);
-		return NULL;
-	}
 	err = check_range(type, min, max, step, def);
 	if (err) {
 		handler_set_err(hdl, err);
@@ -2469,6 +2460,9 @@ int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc)
 	if (rc)
 		return rc;
 
+	/* VIDIOC_QUERYCTRL is not allowed to see hidden controls */
+	if (qc->flags & V4L2_CTRL_FLAG_HIDDEN)
+		return -EINVAL;
 	qc->id = qec.id;
 	qc->type = qec.type;
 	qc->flags = qec.flags;
Signature · 1 line
1.8.5.2
#1 lore raw

(Sorry for the delay)

Quoted 43 lines · Hans Verkuil

Previously hidden controls were not allowed in the user class due to backwards compatibility reasons (QUERYCTRL should not see them), but by simply testing if QUERYCTRL found a hidden control and returning -EINVAL this limitation can be lifted.

---
 drivers/media/v4l2-core/v4l2-ctrls.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/media/v4l2-core/v4l2-ctrls.c +3 -10
index bc30c50..859ac29 100644
@@ -1853,15 +1853,6 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
        /* Complex controls are always hidden */
        if (is_matrix || type >= V4L2_CTRL_COMPLEX_TYPES)
                flags |= V4L2_CTRL_FLAG_HIDDEN;
-       /*
-        * No hidden controls are allowed in the USER class
-        * due to backwards compatibility with old applications.
-        */
-       if (V4L2_CTRL_ID2CLASS(id) == V4L2_CTRL_CLASS_USER &&
-           (flags & V4L2_CTRL_FLAG_HIDDEN)) {
-               handler_set_err(hdl, -EINVAL);
-               return NULL;
-       }
        err = check_range(type, min, max, step, def);
        if (err) {
                handler_set_err(hdl, err);
@@ -2469,6 +2460,9 @@ int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc)
        if (rc)
                return rc;
 
+       /* VIDIOC_QUERYCTRL is not allowed to see hidden controls */
+       if (qc->flags & V4L2_CTRL_FLAG_HIDDEN)
+               return -EINVAL;
        qc->id = qec.id;
        qc->type = qec.type;
        qc->flags = qec.flags;
--

1.8.5.2

Signature · 1 line
Ricardo Ribalda