1 <refentry id="vidioc-g-ext-ctrls">
3 <refentrytitle>ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS,
4 VIDIOC_TRY_EXT_CTRLS</refentrytitle>
9 <refname>VIDIOC_G_EXT_CTRLS</refname>
10 <refname>VIDIOC_S_EXT_CTRLS</refname>
11 <refname>VIDIOC_TRY_EXT_CTRLS</refname>
12 <refpurpose>Get or set the value of several controls, try control
19 <funcdef>int <function>ioctl</function></funcdef>
20 <paramdef>int <parameter>fd</parameter></paramdef>
21 <paramdef>int <parameter>request</parameter></paramdef>
22 <paramdef>struct v4l2_ext_controls
23 *<parameter>argp</parameter></paramdef>
29 <title>Arguments</title>
33 <term><parameter>fd</parameter></term>
39 <term><parameter>request</parameter></term>
41 <para>VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS,
42 VIDIOC_TRY_EXT_CTRLS</para>
46 <term><parameter>argp</parameter></term>
55 <title>Description</title>
57 <para>These ioctls allow the caller to get or set multiple
58 controls atomically. Control IDs are grouped into control classes (see
59 <xref linkend="ctrl-class" />) and all controls in the control array
60 must belong to the same control class.</para>
62 <para>Applications must always fill in the
63 <structfield>count</structfield>,
64 <structfield>ctrl_class</structfield>,
65 <structfield>controls</structfield> and
66 <structfield>reserved</structfield> fields of &v4l2-ext-controls;, and
67 initialize the &v4l2-ext-control; array pointed to by the
68 <structfield>controls</structfield> fields.</para>
70 <para>To get the current value of a set of controls applications
71 initialize the <structfield>id</structfield>,
72 <structfield>size</structfield> and <structfield>reserved2</structfield> fields
73 of each &v4l2-ext-control; and call the
74 <constant>VIDIOC_G_EXT_CTRLS</constant> ioctl. String controls controls
75 must also set the <structfield>string</structfield> field.</para>
77 <para>If the <structfield>size</structfield> is too small to
78 receive the control result (only relevant for pointer-type controls
79 like strings), then the driver will set <structfield>size</structfield>
80 to a valid value and return an &ENOSPC;. You should re-allocate the
81 string memory to this new size and try again. It is possible that the
82 same issue occurs again if the string has grown in the meantime. It is
83 recommended to call &VIDIOC-QUERYCTRL; first and use
84 <structfield>maximum</structfield>+1 as the new <structfield>size</structfield>
85 value. It is guaranteed that that is sufficient memory.
88 <para>To change the value of a set of controls applications
89 initialize the <structfield>id</structfield>, <structfield>size</structfield>,
90 <structfield>reserved2</structfield> and
91 <structfield>value/string</structfield> fields of each &v4l2-ext-control; and
92 call the <constant>VIDIOC_S_EXT_CTRLS</constant> ioctl. The controls
93 will only be set if <emphasis>all</emphasis> control values are
96 <para>To check if a set of controls have correct values applications
97 initialize the <structfield>id</structfield>, <structfield>size</structfield>,
98 <structfield>reserved2</structfield> and
99 <structfield>value/string</structfield> fields of each &v4l2-ext-control; and
100 call the <constant>VIDIOC_TRY_EXT_CTRLS</constant> ioctl. It is up to
101 the driver whether wrong values are automatically adjusted to a valid
102 value or if an error is returned.</para>
104 <para>When the <structfield>id</structfield> or
105 <structfield>ctrl_class</structfield> is invalid drivers return an
106 &EINVAL;. When the value is out of bounds drivers can choose to take
107 the closest valid value or return an &ERANGE;, whatever seems more
108 appropriate. In the first case the new value is set in
109 &v4l2-ext-control;.</para>
111 <para>The driver will only set/get these controls if all control
112 values are correct. This prevents the situation where only some of the
113 controls were set/get. Only low-level errors (⪚ a failed i2c
114 command) can still cause this situation.</para>
116 <table pgwide="1" frame="none" id="v4l2-ext-control">
117 <title>struct <structname>v4l2_ext_control</structname></title>
123 <entry><structfield>id</structfield></entry>
125 <entry>Identifies the control, set by the
130 <entry><structfield>size</structfield></entry>
132 <entry>The total size in bytes of the payload of this
133 control. This is normally 0, but for pointer controls this should be
134 set to the size of the memory containing the payload, or that will
135 receive the payload. If <constant>VIDIOC_G_EXT_CTRLS</constant> finds
136 that this value is less than is required to store
137 the payload result, then it is set to a value large enough to store the
138 payload result and ENOSPC is returned. Note that for string controls
139 this <structfield>size</structfield> field should not be confused with the length of the string.
140 This field refers to the size of the memory that contains the string.
141 The actual <emphasis>length</emphasis> of the string may well be much smaller.
146 <entry><structfield>reserved2</structfield>[1]</entry>
148 <entry>Reserved for future extensions. Drivers and
149 applications must set the array to zero.</entry>
153 <entry>(anonymous)</entry>
158 <entry><structfield>value</structfield></entry>
159 <entry>New value or current value.</entry>
164 <entry><structfield>value64</structfield></entry>
165 <entry>New value or current value.</entry>
169 <entry>char *</entry>
170 <entry><structfield>string</structfield></entry>
171 <entry>A pointer to a string.</entry>
177 <table pgwide="1" frame="none" id="v4l2-ext-controls">
178 <title>struct <structname>v4l2_ext_controls</structname></title>
184 <entry><structfield>ctrl_class</structfield></entry>
185 <entry>The control class to which all controls belong, see
186 <xref linkend="ctrl-class" />.</entry>
190 <entry><structfield>count</structfield></entry>
191 <entry>The number of controls in the controls array. May
192 also be zero.</entry>
196 <entry><structfield>error_idx</structfield></entry>
197 <entry>Set by the driver in case of an error. It is the
198 index of the control causing the error or equal to 'count' when the
199 error is not associated with a particular control. Undefined when the
200 ioctl returns 0 (success).</entry>
204 <entry><structfield>reserved</structfield>[2]</entry>
205 <entry>Reserved for future extensions. Drivers and
206 applications must set the array to zero.</entry>
209 <entry>&v4l2-ext-control; *</entry>
210 <entry><structfield>controls</structfield></entry>
211 <entry>Pointer to an array of
212 <structfield>count</structfield> v4l2_ext_control structures. Ignored
213 if <structfield>count</structfield> equals zero.</entry>
219 <table pgwide="1" frame="none" id="ctrl-class">
220 <title>Control classes</title>
225 <entry><constant>V4L2_CTRL_CLASS_USER</constant></entry>
226 <entry>0x980000</entry>
227 <entry>The class containing user controls. These controls
228 are described in <xref linkend="control" />. All controls that can be set
229 using the &VIDIOC-S-CTRL; and &VIDIOC-G-CTRL; ioctl belong to this
233 <entry><constant>V4L2_CTRL_CLASS_MPEG</constant></entry>
234 <entry>0x990000</entry>
235 <entry>The class containing MPEG compression controls.
236 These controls are described in <xref
237 linkend="mpeg-controls" />.</entry>
240 <entry><constant>V4L2_CTRL_CLASS_CAMERA</constant></entry>
241 <entry>0x9a0000</entry>
242 <entry>The class containing camera controls.
243 These controls are described in <xref
244 linkend="camera-controls" />.</entry>
247 <entry><constant>V4L2_CTRL_CLASS_FM_TX</constant></entry>
248 <entry>0x9b0000</entry>
249 <entry>The class containing FM Transmitter (FM TX) controls.
250 These controls are described in <xref
251 linkend="fm-tx-controls" />.</entry>
264 <term><errorcode>EINVAL</errorcode></term>
266 <para>The &v4l2-ext-control; <structfield>id</structfield>
267 is invalid or the &v4l2-ext-controls;
268 <structfield>ctrl_class</structfield> is invalid. This error code is
269 also returned by the <constant>VIDIOC_S_EXT_CTRLS</constant> and
270 <constant>VIDIOC_TRY_EXT_CTRLS</constant> ioctls if two or more
271 control values are in conflict.</para>
275 <term><errorcode>ERANGE</errorcode></term>
277 <para>The &v4l2-ext-control; <structfield>value</structfield>
278 is out of bounds.</para>
282 <term><errorcode>EBUSY</errorcode></term>
284 <para>The control is temporarily not changeable, possibly
285 because another applications took over control of the device function
286 this control belongs to.</para>
290 <term><errorcode>ENOSPC</errorcode></term>
292 <para>The space reserved for the control's payload is insufficient.
293 The field <structfield>size</structfield> is set to a value that is enough
294 to store the payload and this error code is returned.</para>
304 sgml-parent-document: "v4l2.sgml"
305 indent-tabs-mode: nil