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. If the <structfield>value</structfield>
68 is inappropriate for the control (e.g. if it refers to an unsupported
69 menu index of a menu control), then &EINVAL; is returned as well.</para>
71 <para>These ioctls work only with user controls. For other
72 control classes the &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS; or
73 &VIDIOC-TRY-EXT-CTRLS; must be used.</para>
75 <table pgwide="1" frame="none" id="v4l2-control">
76 <title>struct <structname>v4l2_control</structname></title>
82 <entry><structfield>id</structfield></entry>
83 <entry>Identifies the control, set by the
88 <entry><structfield>value</structfield></entry>
89 <entry>New value or current value.</entry>
101 <term><errorcode>EINVAL</errorcode></term>
103 <para>The &v4l2-control; <structfield>id</structfield> is
104 invalid or the <structfield>value</structfield> is inappropriate for
105 the given control (i.e. if a menu item is selected that is not supported
106 by the driver according to &VIDIOC-QUERYMENU;).</para>
110 <term><errorcode>ERANGE</errorcode></term>
112 <para>The &v4l2-control; <structfield>value</structfield>
113 is out of bounds.</para>
117 <term><errorcode>EBUSY</errorcode></term>
119 <para>The control is temporarily not changeable, possibly
120 because another applications took over control of the device function
121 this control belongs to.</para>
125 <term><errorcode>EACCES</errorcode></term>
127 <para>Attempt to set a read-only control or to get a
128 write-only control.</para>