1 <refentry id="vidioc-g-ctrl">
3 <refentrytitle>ioctl VIDIOC_G_CTRL, VIDIOC_S_CTRL</refentrytitle>
8 <refname>VIDIOC_G_CTRL</refname>
9 <refname>VIDIOC_S_CTRL</refname>
10 <refpurpose>Get or set the value of a control</refpurpose>
16 <funcdef>int <function>ioctl</function></funcdef>
17 <paramdef>int <parameter>fd</parameter></paramdef>
18 <paramdef>int <parameter>request</parameter></paramdef>
19 <paramdef>struct v4l2_control
20 *<parameter>argp</parameter></paramdef>
26 <title>Arguments</title>
30 <term><parameter>fd</parameter></term>
36 <term><parameter>request</parameter></term>
38 <para>VIDIOC_G_CTRL, VIDIOC_S_CTRL</para>
42 <term><parameter>argp</parameter></term>
51 <title>Description</title>
53 <para>To get the current value of a control applications
54 initialize the <structfield>id</structfield> field of a struct
55 <structname>v4l2_control</structname> and call the
56 <constant>VIDIOC_G_CTRL</constant> ioctl with a pointer to this
57 structure. To change the value of a control applications initialize
58 the <structfield>id</structfield> and <structfield>value</structfield>
59 fields of a struct <structname>v4l2_control</structname> and call the
60 <constant>VIDIOC_S_CTRL</constant> ioctl.</para>
62 <para>When the <structfield>id</structfield> is invalid drivers
63 return an &EINVAL;. When the <structfield>value</structfield> is out
64 of bounds drivers can choose to take the closest valid value or return
65 an &ERANGE;, whatever seems more appropriate. However,
66 <constant>VIDIOC_S_CTRL</constant> is a write-only ioctl, it does not
67 return the actual new value.</para>
69 <para>These ioctls work only with user controls. For other
70 control classes the &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS; or
71 &VIDIOC-TRY-EXT-CTRLS; must be used.</para>
73 <table pgwide="1" frame="none" id="v4l2-control">
74 <title>struct <structname>v4l2_control</structname></title>
80 <entry><structfield>id</structfield></entry>
81 <entry>Identifies the control, set by the
86 <entry><structfield>value</structfield></entry>
87 <entry>New value or current value.</entry>
99 <term><errorcode>EINVAL</errorcode></term>
101 <para>The &v4l2-control; <structfield>id</structfield> is
106 <term><errorcode>ERANGE</errorcode></term>
108 <para>The &v4l2-control; <structfield>value</structfield>
109 is out of bounds.</para>
113 <term><errorcode>EBUSY</errorcode></term>
115 <para>The control is temporarily not changeable, possibly
116 because another applications took over control of the device function
117 this control belongs to.</para>
121 <term><errorcode>EACCES</errorcode></term>
123 <para>Attempt to set a read-only control or to get a
124 write-only control.</para>