Skip to contentSkip to conversation

media: vidioc-queryctrl.rst: clarify combining READ_ONLY with WRITE_ONLY

PATCH In review Helen Koike 2 participants 4 messages Sep 25, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: vidioc-queryctrl.rst: clarify combining READ_ONLY with WRITE_ONLY

Make it clear in the documentation that V4L2_CTRL_FLAG_READ_ONLY doesn't conflict with V4L2_CTRL_FLAG_WRITE_ONLY. Also make it clear that if both are combined then the control has read and write permissions.

---
Hi,

v4l2-compliance expects both flags for read and write permissions, so I would like to make it clear in the docs.
Please let me know if this is not the case.

Thanks
Helen

---
 Documentation/media/uapi/v4l/vidioc-queryctrl.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/media/uapi/v4l/vidioc-queryctrl.rst +10 -0
index a3d56ffbf4cc..1d3aecdf679f 100644
@@ -500,6 +500,11 @@ See also the examples in :ref:`control`.
       - 0x0004
       - This control is permanently readable only. Any attempt to change
 	the control will result in an ``EINVAL`` error code.
+
+	.. note::
+
+	   If combined with ``V4L2_CTRL_FLAG_WRITE_ONLY``, then both, read
+	   and write are allowed.
     * - ``V4L2_CTRL_FLAG_UPDATE``
       - 0x0008
       - A hint that changing this control may affect the value of other
@@ -523,6 +528,11 @@ See also the examples in :ref:`control`.
 	where writing a value will cause the device to carry out a given
 	action (e. g. motor control) but no meaningful value can be
 	returned.
+
+	.. note::
+
+	   If combined with ``V4L2_CTRL_FLAG_READ_ONLY``, then both, read
+	   and write are allowed.
     * - ``V4L2_CTRL_FLAG_VOLATILE``
       - 0x0080
       - This control is volatile, which means that the value of the
Signature · 1 line
2.22.0
#1 lore raw
Quoted 3 lines · Helen Koike

Make it clear in the documentation that V4L2_CTRL_FLAG_READ_ONLY doesn't conflict with V4L2_CTRL_FLAG_WRITE_ONLY. Also make it clear that if both are combined then the control has read and write permissions.

That doesn't look right.

This is the test in v4l2-compliance:

__u32 rw_mask = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;

if ((fl & rw_mask) == rw_mask)

	return fail("can't read nor write this control\n");

If both flags are set, then a fail is reported.

Did you mis-read?

Setting both flags makes no sense.

Regards,

Hans

Quoted 45 lines

---
Hi,

v4l2-compliance expects both flags for read and write permissions, so I would like to make it clear in the docs.
Please let me know if this is not the case.

Thanks
Helen

---
 Documentation/media/uapi/v4l/vidioc-queryctrl.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/media/uapi/v4l/vidioc-queryctrl.rst +10 -0
index a3d56ffbf4cc..1d3aecdf679f 100644
@@ -500,6 +500,11 @@ See also the examples in :ref:`control`.
       - 0x0004
       - This control is permanently readable only. Any attempt to change
 	the control will result in an ``EINVAL`` error code.
+
+	.. note::
+
+	   If combined with ``V4L2_CTRL_FLAG_WRITE_ONLY``, then both, read
+	   and write are allowed.
     * - ``V4L2_CTRL_FLAG_UPDATE``
       - 0x0008
       - A hint that changing this control may affect the value of other
@@ -523,6 +528,11 @@ See also the examples in :ref:`control`.
 	where writing a value will cause the device to carry out a given
 	action (e. g. motor control) but no meaningful value can be
 	returned.
+
+	.. note::
+
+	   If combined with ``V4L2_CTRL_FLAG_READ_ONLY``, then both, read
+	   and write are allowed.
     * - ``V4L2_CTRL_FLAG_VOLATILE``
       - 0x0080
       - This control is volatile, which means that the value of the
#2 lore raw

Hi Hans

Quoted 11 lines · Hans Verkuil
Quoted 3 lines · Helen Koike

Make it clear in the documentation that V4L2_CTRL_FLAG_READ_ONLY doesn't conflict with V4L2_CTRL_FLAG_WRITE_ONLY. Also make it clear that if both are combined then the control has read and write permissions.

That doesn't look right.

This is the test in v4l2-compliance:

__u32 rw_mask = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;

Quoted 8 lines

if ((fl & rw_mask) == rw_mask)

	return fail("can't read nor write this control\n");

If both flags are set, then a fail is reported.

Did you mis-read?

Setting both flags makes no sense.

Maybe I misunderstood the V4L2_CTRL_TYPE_CTRL_CLASS, from v4l2-compliance:

	case V4L2_CTRL_TYPE_CTRL_CLASS:
		if (fl != (V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY))
			return fail("invalid flags for control class\n");

I was confused why vivid was using both flags in vivid_ctrl_class (and also the debayer patch that was following this model).

Why both flags are expected when this type is used?

Thanks,
Helen

Quoted 51 lines

Regards,

Hans

Quoted 45 lines

---
Hi,

v4l2-compliance expects both flags for read and write permissions, so I would like to make it clear in the docs.
Please let me know if this is not the case.

Thanks
Helen

---
 Documentation/media/uapi/v4l/vidioc-queryctrl.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/media/uapi/v4l/vidioc-queryctrl.rst +10 -0
index a3d56ffbf4cc..1d3aecdf679f 100644
@@ -500,6 +500,11 @@ See also the examples in :ref:`control`.
       - 0x0004
       - This control is permanently readable only. Any attempt to change
 	the control will result in an ``EINVAL`` error code.
+
+	.. note::
+
+	   If combined with ``V4L2_CTRL_FLAG_WRITE_ONLY``, then both, read
+	   and write are allowed.
     * - ``V4L2_CTRL_FLAG_UPDATE``
       - 0x0008
       - A hint that changing this control may affect the value of other
@@ -523,6 +528,11 @@ See also the examples in :ref:`control`.
 	where writing a value will cause the device to carry out a given
 	action (e. g. motor control) but no meaningful value can be
 	returned.
+
+	.. note::
+
+	   If combined with ``V4L2_CTRL_FLAG_READ_ONLY``, then both, read
+	   and write are allowed.
     * - ``V4L2_CTRL_FLAG_VOLATILE``
       - 0x0080
       - This control is volatile, which means that the value of the
#3 lore raw
Quoted 25 lines · Helen Koike

Hi Hans

Quoted 11 lines · Hans Verkuil
Quoted 3 lines · Helen Koike

Make it clear in the documentation that V4L2_CTRL_FLAG_READ_ONLY doesn't conflict with V4L2_CTRL_FLAG_WRITE_ONLY. Also make it clear that if both are combined then the control has read and write permissions.

That doesn't look right.

This is the test in v4l2-compliance:

__u32 rw_mask = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;

Quoted 8 lines

if ((fl & rw_mask) == rw_mask)

	return fail("can't read nor write this control\n");

If both flags are set, then a fail is reported.

Did you mis-read?

Setting both flags makes no sense.

Maybe I misunderstood the V4L2_CTRL_TYPE_CTRL_CLASS, from v4l2-compliance:

Quoted 7 lines
	case V4L2_CTRL_TYPE_CTRL_CLASS:
		if (fl != (V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY))
			return fail("invalid flags for control class\n");

I was confused why vivid was using both flags in vivid_ctrl_class (and also the debayer patch that was following this model).

Why both flags are expected when this type is used?

Ah, now I understand. This is specific to control classes: such controls cannot be read nor written. They just provide a name for the control class, but both G_CTRL and S_CTRL should fail.

So this specific combination of flags is specific to control classes only.

This works because a 'get' will fail if WRITE_ONLY is set, and a 'set' will fail if READ_ONLY is set. Setting both flags will cause both 'get' and 'set' to fail.

It is admittedly a bit confusing.

Regards,

Hans

Quoted 55 lines

Thanks,
Helen

Quoted 51 lines

Regards,

Hans

Quoted 45 lines

---
Hi,

v4l2-compliance expects both flags for read and write permissions, so I would like to make it clear in the docs.
Please let me know if this is not the case.

Thanks
Helen

---
 Documentation/media/uapi/v4l/vidioc-queryctrl.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/media/uapi/v4l/vidioc-queryctrl.rst +10 -0
index a3d56ffbf4cc..1d3aecdf679f 100644
@@ -500,6 +500,11 @@ See also the examples in :ref:`control`.
       - 0x0004
       - This control is permanently readable only. Any attempt to change
 	the control will result in an ``EINVAL`` error code.
+
+	.. note::
+
+	   If combined with ``V4L2_CTRL_FLAG_WRITE_ONLY``, then both, read
+	   and write are allowed.
     * - ``V4L2_CTRL_FLAG_UPDATE``
       - 0x0008
       - A hint that changing this control may affect the value of other
@@ -523,6 +528,11 @@ See also the examples in :ref:`control`.
 	where writing a value will cause the device to carry out a given
 	action (e. g. motor control) but no meaningful value can be
 	returned.
+
+	.. note::
+
+	   If combined with ``V4L2_CTRL_FLAG_READ_ONLY``, then both, read
+	   and write are allowed.
     * - ``V4L2_CTRL_FLAG_VOLATILE``
       - 0x0080
       - This control is volatile, which means that the value of the