diff mbox series

[yavta,1/3] Fix emulation of old API for string controls

Message ID 20190220151952.15376-2-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series Fixes for compound control support | expand

Commit Message

Laurent Pinchart Feb. 20, 2019, 3:19 p.m. UTC
For kernel versions that didn't define the V4L2_CTRL_FLAG_HAS_PAYLOAD
flag, commits 2f146567186f ("Implement compound control get support")
and 4480b561404f ("Implement compound control set support") broke string
control support. Fix this by emulating the V4L2_CTRL_FLAG_HAS_PAYLOAD
and compound control API for the older API.

Fixes: 2f146567186f ("Implement compound control get support")
Fixes: 4480b561404f ("Implement compound control set support")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 yavta.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/yavta.c b/yavta.c
index 0efa7d73e432..7d9c40c9f9be 100644
--- a/yavta.c
+++ b/yavta.c
@@ -637,6 +637,12 @@  static int query_control(struct device *dev, unsigned int id,
 	query->default_value = q.default_value;
 	query->flags = q.flags;
 
+	if (q.type == V4L2_CTRL_TYPE_STRING &&
+	    !(q.flags & V4L2_CTRL_FLAG_HAS_PAYLOAD)) {
+		query->elem_size = q.maximum + 1;
+		query->elems = 1;
+	}
+
 	return 0;
 }