1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="user-func.html" title="Appendix&#160;A.&#160;Function Reference"><link rel="prev" href="vidioc-querycap.html" title="ioctl VIDIOC_QUERYCAP"><link rel="next" href="vidioc-query-dv-timings.html" title="ioctl VIDIOC_QUERY_DV_TIMINGS"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-querycap.html">Prev</a>&#160;</td><th width="60%" align="center">Appendix&#160;A.&#160;Function Reference</th><td width="20%" align="right">&#160;<a accesskey="n" href="vidioc-query-dv-timings.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="vidioc-queryctrl"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU &#8212; Enumerate controls and menu control items</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">request</var>, </td></tr><tr><td>&#160;</td><td>struct v4l2_queryctrl *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">request</var>, </td></tr><tr><td>&#160;</td><td>struct v4l2_query_ext_ctrl *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">request</var>, </td></tr><tr><td>&#160;</td><td>struct v4l2_querymenu *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1115925156"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>File descriptor returned by <a class="link" href="func-open.html" title="V4L2 open()"><code class="function">open()</code></a>.</p></dd><dt><span class="term"><em class="parameter"><code>request</code></em></span></dt><dd><p>VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU</p></dd><dt><span class="term"><em class="parameter"><code>argp</code></em></span></dt><dd><p></p></dd></dl></div></div><div class="refsect1"><a name="idp1115929284"></a><h2>Description</h2><p>To query the attributes of a control applications set the
2<em class="structfield"><code>id</code></em> field of a struct&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table&#160;A.95.&#160;struct v4l2_queryctrl">v4l2_queryctrl</a> and call the
3<code class="constant">VIDIOC_QUERYCTRL</code> ioctl with a pointer to this
4structure. The driver fills the rest of the structure or returns an
5<span class="errorcode">EINVAL</span> error code when the <em class="structfield"><code>id</code></em> is invalid.</p><p>It is possible to enumerate controls by calling
6<code class="constant">VIDIOC_QUERYCTRL</code> with successive
7<em class="structfield"><code>id</code></em> values starting from
8<code class="constant">V4L2_CID_BASE</code> up to and exclusive
9<code class="constant">V4L2_CID_LASTP1</code>. Drivers may return
10<span class="errorcode">EINVAL</span> if a control in this range is not
11supported. Further applications can enumerate private controls, which
12are not defined in this specification, by starting at
13<code class="constant">V4L2_CID_PRIVATE_BASE</code> and incrementing
14<em class="structfield"><code>id</code></em> until the driver returns
15<span class="errorcode">EINVAL</span>.</p><p>In both cases, when the driver sets the
16<code class="constant">V4L2_CTRL_FLAG_DISABLED</code> flag in the
17<em class="structfield"><code>flags</code></em> field this control is permanently
18disabled and should be ignored by the application.<a href="#ftn.idp1115934660" class="footnote" name="idp1115934660"><sup class="footnote">[19]</sup></a></p><p>When the application ORs <em class="structfield"><code>id</code></em> with
19<code class="constant">V4L2_CTRL_FLAG_NEXT_CTRL</code> the driver returns the
20next supported non-compound control, or <span class="errorcode">EINVAL</span>
21if there is none. In addition, the <code class="constant">V4L2_CTRL_FLAG_NEXT_COMPOUND</code>
22flag can be specified to enumerate all compound controls (i.e. controls
23with type &#8805; <code class="constant">V4L2_CTRL_COMPOUND_TYPES</code>). Specify both
24<code class="constant">V4L2_CTRL_FLAG_NEXT_CTRL</code> and
25<code class="constant">V4L2_CTRL_FLAG_NEXT_COMPOUND</code> in order to enumerate
26all controls, compound or not. Drivers which do not support these flags yet
27always return <span class="errorcode">EINVAL</span>.</p><p>The <code class="constant">VIDIOC_QUERY_EXT_CTRL</code> ioctl was
28introduced in order to better support controls that can use compound
29types, and to expose additional control information that cannot be
30returned in struct&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table&#160;A.95.&#160;struct v4l2_queryctrl">v4l2_queryctrl</a> since that structure is full.</p><p><code class="constant">VIDIOC_QUERY_EXT_CTRL</code> is used in the
31same way as <code class="constant">VIDIOC_QUERYCTRL</code>, except that the
32<em class="structfield"><code>reserved</code></em> array must be zeroed as well.</p><p>Additional information is required for menu controls: the
33names of the menu items. To query them applications set the
34<em class="structfield"><code>id</code></em> and <em class="structfield"><code>index</code></em>
35fields of struct&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-querymenu" title="Table&#160;A.97.&#160;struct v4l2_querymenu">v4l2_querymenu</a> and call the
36<code class="constant">VIDIOC_QUERYMENU</code> ioctl with a pointer to this
37structure. The driver fills the rest of the structure or returns an
38<span class="errorcode">EINVAL</span> error code when the <em class="structfield"><code>id</code></em> or
39<em class="structfield"><code>index</code></em> is invalid. Menu items are enumerated
40by calling <code class="constant">VIDIOC_QUERYMENU</code> with successive
41<em class="structfield"><code>index</code></em> values from struct&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table&#160;A.95.&#160;struct v4l2_queryctrl">v4l2_queryctrl</a>
42<em class="structfield"><code>minimum</code></em> to
43<em class="structfield"><code>maximum</code></em>, inclusive. Note that it is possible
44for <code class="constant">VIDIOC_QUERYMENU</code> to return an <span class="errorcode">EINVAL</span> error code for some
45indices between <em class="structfield"><code>minimum</code></em> and <em class="structfield"><code>maximum</code></em>.
46In that case that particular menu item is not supported by this driver. Also note that
47the <em class="structfield"><code>minimum</code></em> value is not necessarily 0.</p><p>See also the examples in <a class="xref" href="control.html" title="User Controls">the section called &#8220;User Controls&#8221;</a>.</p><div class="table"><a name="v4l2-queryctrl"></a><p class="title"><b>Table&#160;A.95.&#160;struct <span class="structname">v4l2_queryctrl</span></b></p><div class="table-contents"><table summary="struct v4l2_queryctrl" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>id</code></em></td><td valign="top">Identifies the control, set by the application. See
48<a class="xref" href="control.html#control-id" title="Table&#160;1.1.&#160;Control IDs">Table&#160;1.1, &#8220;Control IDs&#8221;</a> for predefined IDs. When the ID is ORed
49with V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and returns
50the first control with a higher ID. Drivers which do not support this
51flag yet always return an <span class="errorcode">EINVAL</span> error code.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>type</code></em></td><td valign="top">Type of control, see <a class="xref" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table&#160;A.98.&#160;enum v4l2_ctrl_type">Table&#160;A.98, &#8220;enum v4l2_ctrl_type&#8221;</a>.</td></tr><tr><td valign="top">__u8</td><td valign="top"><em class="structfield"><code>name</code></em>[32]</td><td valign="top">Name of the control, a NUL-terminated ASCII
52string. This information is intended for the user.</td></tr><tr><td valign="top">__s32</td><td valign="top"><em class="structfield"><code>minimum</code></em></td><td valign="top">Minimum value, inclusive. This field gives a lower
53bound for the control. See enum&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table&#160;A.98.&#160;enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the minimum value is to
54be used for each possible control type. Note that this a signed 32-bit value.</td></tr><tr><td valign="top">__s32</td><td valign="top"><em class="structfield"><code>maximum</code></em></td><td valign="top">Maximum value, inclusive. This field gives an upper
55bound for the control. See enum&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table&#160;A.98.&#160;enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the maximum value is to
56be used for each possible control type. Note that this a signed 32-bit value.</td></tr><tr><td valign="top">__s32</td><td valign="top"><em class="structfield"><code>step</code></em></td><td valign="top"><p>This field gives a step size for the control.
57See enum&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table&#160;A.98.&#160;enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the step value is to be used for each possible
58control type. Note that this an unsigned 32-bit value.
59</p><p>Generally drivers should not scale hardware
60control values. It may be necessary for example when the
61<em class="structfield"><code>name</code></em> or <em class="structfield"><code>id</code></em> imply
62a particular unit and the hardware actually accepts only multiples of
63said unit. If so, drivers must take care values are properly rounded
64when scaling, such that errors will not accumulate on repeated
65read-write cycles.</p><p>This field gives the smallest change of
66an integer control actually affecting hardware. Often the information
67is needed when the user can change controls by keyboard or GUI
68buttons, rather than a slider. When for example a hardware register
69accepts values 0-511 and the driver reports 0-65535, step should be
70128.</p><p>Note that although signed, the step value is supposed to
71be always positive.</p></td></tr><tr><td valign="top">__s32</td><td valign="top"><em class="structfield"><code>default_value</code></em></td><td valign="top">The default value of a
72<code class="constant">V4L2_CTRL_TYPE_INTEGER</code>,
73<code class="constant">_BOOLEAN</code>, <code class="constant">_BITMASK</code>,
74<code class="constant">_MENU</code> or <code class="constant">_INTEGER_MENU</code> control.
75Not valid for other types of controls.
76Note that drivers reset controls to their default value only when the
77driver is first loaded, never afterwards.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>flags</code></em></td><td valign="top">Control flags, see <a class="xref" href="vidioc-queryctrl.html#control-flags" title="Table&#160;A.99.&#160;Control Flags">Table&#160;A.99, &#8220;Control Flags&#8221;</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved</code></em>[2]</td><td valign="top">Reserved for future extensions. Drivers must set
78the array to zero.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-query-ext-ctrl"></a><p class="title"><b>Table&#160;A.96.&#160;struct <span class="structname">v4l2_query_ext_ctrl</span></b></p><div class="table-contents"><table summary="struct v4l2_query_ext_ctrl" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>id</code></em></td><td valign="top">Identifies the control, set by the application. See
79<a class="xref" href="control.html#control-id" title="Table&#160;1.1.&#160;Control IDs">Table&#160;1.1, &#8220;Control IDs&#8221;</a> for predefined IDs. When the ID is ORed
80with <code class="constant">V4L2_CTRL_FLAG_NEXT_CTRL</code> the driver clears the
81flag and returns the first non-compound control with a higher ID. When the
82ID is ORed with <code class="constant">V4L2_CTRL_FLAG_NEXT_COMPOUND</code> the driver
83clears the flag and returns the first compound control with a higher ID.
84Set both to get the first control (compound or not) with a higher ID.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>type</code></em></td><td valign="top">Type of control, see <a class="xref" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table&#160;A.98.&#160;enum v4l2_ctrl_type">Table&#160;A.98, &#8220;enum v4l2_ctrl_type&#8221;</a>.</td></tr><tr><td valign="top">char</td><td valign="top"><em class="structfield"><code>name</code></em>[32]</td><td valign="top">Name of the control, a NUL-terminated ASCII
85string. This information is intended for the user.</td></tr><tr><td valign="top">__s64</td><td valign="top"><em class="structfield"><code>minimum</code></em></td><td valign="top">Minimum value, inclusive. This field gives a lower
86bound for the control. See enum&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table&#160;A.98.&#160;enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the minimum value is to
87be used for each possible control type. Note that this a signed 64-bit value.</td></tr><tr><td valign="top">__s64</td><td valign="top"><em class="structfield"><code>maximum</code></em></td><td valign="top">Maximum value, inclusive. This field gives an upper
88bound for the control. See enum&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table&#160;A.98.&#160;enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the maximum value is to
89be used for each possible control type. Note that this a signed 64-bit value.</td></tr><tr><td valign="top">__u64</td><td valign="top"><em class="structfield"><code>step</code></em></td><td valign="top"><p>This field gives a step size for the control.
90See enum&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table&#160;A.98.&#160;enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the step value is to be used for each possible
91control type. Note that this an unsigned 64-bit value.
92</p><p>Generally drivers should not scale hardware
93control values. It may be necessary for example when the
94<em class="structfield"><code>name</code></em> or <em class="structfield"><code>id</code></em> imply
95a particular unit and the hardware actually accepts only multiples of
96said unit. If so, drivers must take care values are properly rounded
97when scaling, such that errors will not accumulate on repeated
98read-write cycles.</p><p>This field gives the smallest change of
99an integer control actually affecting hardware. Often the information
100is needed when the user can change controls by keyboard or GUI
101buttons, rather than a slider. When for example a hardware register
102accepts values 0-511 and the driver reports 0-65535, step should be
103128.</p></td></tr><tr><td valign="top">__s64</td><td valign="top"><em class="structfield"><code>default_value</code></em></td><td valign="top">The default value of a
104<code class="constant">V4L2_CTRL_TYPE_INTEGER</code>, <code class="constant">_INTEGER64</code>,
105<code class="constant">_BOOLEAN</code>, <code class="constant">_BITMASK</code>,
106<code class="constant">_MENU</code>, <code class="constant">_INTEGER_MENU</code>,
107<code class="constant">_U8</code> or <code class="constant">_U16</code> control.
108Not valid for other types of controls.
109Note that drivers reset controls to their default value only when the
110driver is first loaded, never afterwards.
111</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>flags</code></em></td><td valign="top">Control flags, see <a class="xref" href="vidioc-queryctrl.html#control-flags" title="Table&#160;A.99.&#160;Control Flags">Table&#160;A.99, &#8220;Control Flags&#8221;</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>elem_size</code></em></td><td valign="top">The size in bytes of a single element of the array.
112Given a char pointer <code class="constant">p</code> to a 3-dimensional array you can find the
113position of cell <code class="constant">(z, y, x)</code> as follows:
114<code class="constant">p + ((z * dims[1] + y) * dims[0] + x) * elem_size</code>. <em class="structfield"><code>elem_size</code></em>
115is always valid, also when the control isn't an array. For string controls
116<em class="structfield"><code>elem_size</code></em> is equal to <em class="structfield"><code>maximum + 1</code></em>.
117</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>elems</code></em></td><td valign="top">The number of elements in the N-dimensional array. If this control
118is not an array, then <em class="structfield"><code>elems</code></em> is 1. The <em class="structfield"><code>elems</code></em>
119field can never be 0.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>nr_of_dims</code></em></td><td valign="top">The number of dimension in the N-dimensional array. If this control
120is not an array, then this field is 0.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>dims[V4L2_CTRL_MAX_DIMS]</code></em></td><td valign="top">The size of each dimension. The first <em class="structfield"><code>nr_of_dims</code></em>
121elements of this array must be non-zero, all remaining elements must be zero.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved</code></em>[32]</td><td valign="top">Reserved for future extensions. Applications and drivers
122must set the array to zero.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-querymenu"></a><p class="title"><b>Table&#160;A.97.&#160;struct <span class="structname">v4l2_querymenu</span></b></p><div class="table-contents"><table summary="struct v4l2_querymenu" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"><col></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top">&#160;</td><td valign="top"><em class="structfield"><code>id</code></em></td><td valign="top">Identifies the control, set by the application
123from the respective struct&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table&#160;A.95.&#160;struct v4l2_queryctrl">v4l2_queryctrl</a>
124<em class="structfield"><code>id</code></em>.</td></tr><tr><td valign="top">__u32</td><td valign="top">&#160;</td><td valign="top"><em class="structfield"><code>index</code></em></td><td valign="top">Index of the menu item, starting at zero, set by
125	    the application.</td></tr><tr><td valign="top">union</td><td valign="top">&#160;</td><td valign="top">&#160;</td><td valign="top">&#160;</td></tr><tr><td valign="top">&#160;</td><td valign="top">__u8</td><td valign="top"><em class="structfield"><code>name</code></em>[32]</td><td valign="top">Name of the menu item, a NUL-terminated ASCII
126string. This information is intended for the user. This field is valid
127for <code class="constant">V4L2_CTRL_FLAG_MENU</code> type controls.</td></tr><tr><td valign="top">&#160;</td><td valign="top">__s64</td><td valign="top"><em class="structfield"><code>value</code></em></td><td valign="top">
128              Value of the integer menu item. This field is valid for
129              <code class="constant">V4L2_CTRL_FLAG_INTEGER_MENU</code> type
130              controls.
131            </td></tr><tr><td valign="top">__u32</td><td valign="top">&#160;</td><td valign="top"><em class="structfield"><code>reserved</code></em></td><td valign="top">Reserved for future extensions. Drivers must set
132the array to zero.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="v4l2-ctrl-type"></a><p class="title"><b>Table&#160;A.98.&#160;enum v4l2_ctrl_type</b></p><div class="table-contents"><table summary="enum v4l2_ctrl_type" width="100%" border="0"><colgroup><col align="left"><col align="center"><col align="center"><col align="center"><col align="left"></colgroup><thead><tr><th align="left">Type</th><th align="center"><em class="structfield"><code>minimum</code></em></th><th align="center"><em class="structfield"><code>step</code></em></th><th align="center"><em class="structfield"><code>maximum</code></em></th><th align="left">Description</th></tr></thead><tbody valign="top"><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_INTEGER</code></td><td align="center" valign="top">any</td><td align="center" valign="top">any</td><td align="center" valign="top">any</td><td align="left" valign="top">An integer-valued control ranging from minimum to
133maximum inclusive. The step value indicates the increment between
134values which are actually different on the hardware.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_BOOLEAN</code></td><td align="center" valign="top">0</td><td align="center" valign="top">1</td><td align="center" valign="top">1</td><td align="left" valign="top">A boolean-valued control. Zero corresponds to
135"disabled", and one means "enabled".</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_MENU</code></td><td align="center" valign="top">&#8805; 0</td><td align="center" valign="top">1</td><td align="center" valign="top">N-1</td><td align="left" valign="top">The control has a menu of N choices. The names of
136the menu items can be enumerated with the
137<code class="constant">VIDIOC_QUERYMENU</code> ioctl.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_INTEGER_MENU</code></td><td align="center" valign="top">&#8805; 0</td><td align="center" valign="top">1</td><td align="center" valign="top">N-1</td><td align="left" valign="top">
138              The control has a menu of N choices. The values of the
139              menu items can be enumerated with the
140              <code class="constant">VIDIOC_QUERYMENU</code> ioctl. This is
141              similar to <code class="constant">V4L2_CTRL_TYPE_MENU</code>
142              except that instead of strings, the menu items are
143              signed 64-bit integers.
144            </td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_BITMASK</code></td><td align="center" valign="top">0</td><td align="center" valign="top">n/a</td><td align="center" valign="top">any</td><td align="left" valign="top">A bitmask field. The maximum value is the set of bits that can
145be used, all other bits are to be 0. The maximum value is interpreted as a __u32,
146allowing the use of bit 31 in the bitmask.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_BUTTON</code></td><td align="center" valign="top">0</td><td align="center" valign="top">0</td><td align="center" valign="top">0</td><td align="left" valign="top">A control which performs an action when set.
147Drivers must ignore the value passed with
148<code class="constant">VIDIOC_S_CTRL</code> and return an <span class="errorcode">EINVAL</span> error code on a
149<code class="constant">VIDIOC_G_CTRL</code> attempt.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_INTEGER64</code></td><td align="center" valign="top">any</td><td align="center" valign="top">any</td><td align="center" valign="top">any</td><td align="left" valign="top">A 64-bit integer valued control. Minimum, maximum
150and step size cannot be queried using <code class="constant">VIDIOC_QUERYCTRL</code>.
151Only <code class="constant">VIDIOC_QUERY_EXT_CTRL</code> can retrieve the 64-bit
152min/max/step values, they should be interpreted as n/a when using
153<code class="constant">VIDIOC_QUERYCTRL</code>.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_STRING</code></td><td align="center" valign="top">&#8805; 0</td><td align="center" valign="top">&#8805; 1</td><td align="center" valign="top">&#8805; 0</td><td align="left" valign="top">The minimum and maximum string lengths. The step size
154means that the string must be (minimum + N * step) characters long for
155N &#8805; 0. These lengths do not include the terminating zero, so in order to
156pass a string of length 8 to <a class="link" href="vidioc-g-ext-ctrls.html" title="ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, VIDIOC_TRY_EXT_CTRLS"><code class="constant">VIDIOC_S_EXT_CTRLS</code></a> you need to set the
157<em class="structfield"><code>size</code></em> field of struct&#160;<a class="link" href="vidioc-g-ext-ctrls.html#v4l2-ext-control" title="Table&#160;A.66.&#160;struct v4l2_ext_control">v4l2_ext_control</a> to 9. For <a class="link" href="vidioc-g-ext-ctrls.html" title="ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, VIDIOC_TRY_EXT_CTRLS"><code class="constant">VIDIOC_G_EXT_CTRLS</code></a> you can
158set the <em class="structfield"><code>size</code></em> field to <em class="structfield"><code>maximum</code></em> + 1.
159Which character encoding is used will depend on the string control itself and
160should be part of the control documentation.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_CTRL_CLASS</code></td><td align="center" valign="top">n/a</td><td align="center" valign="top">n/a</td><td align="center" valign="top">n/a</td><td align="left" valign="top">This is not a control. When
161<code class="constant">VIDIOC_QUERYCTRL</code> is called with a control ID
162equal to a control class code (see <a class="xref" href="vidioc-g-ext-ctrls.html#ctrl-class" title="Table&#160;A.68.&#160;Control classes">Table&#160;A.68, &#8220;Control classes&#8221;</a>) + 1, the
163ioctl returns the name of the control class and this control type.
164Older drivers which do not support this feature return an
165<span class="errorcode">EINVAL</span> error code.</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_U8</code></td><td align="center" valign="top">any</td><td align="center" valign="top">any</td><td align="center" valign="top">any</td><td align="left" valign="top">An unsigned 8-bit valued control ranging from minimum to
166maximum inclusive. The step value indicates the increment between
167values which are actually different on the hardware.
168</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_U16</code></td><td align="center" valign="top">any</td><td align="center" valign="top">any</td><td align="center" valign="top">any</td><td align="left" valign="top">An unsigned 16-bit valued control ranging from minimum to
169maximum inclusive. The step value indicates the increment between
170values which are actually different on the hardware.
171</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="control-flags"></a><p class="title"><b>Table&#160;A.99.&#160;Control Flags</b></p><div class="table-contents"><table summary="Control Flags" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_DISABLED</code></td><td valign="top">0x0001</td><td valign="top">This control is permanently disabled and should be
172ignored by the application. Any attempt to change the control will
173result in an <span class="errorcode">EINVAL</span> error code.</td></tr><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_GRABBED</code></td><td valign="top">0x0002</td><td valign="top">This control is temporarily unchangeable, for
174example because another application took over control of the
175respective resource. Such controls may be displayed specially in a
176user interface. Attempts to change the control may result in an
177<span class="errorcode">EBUSY</span> error code.</td></tr><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_READ_ONLY</code></td><td valign="top">0x0004</td><td valign="top">This control is permanently readable only. Any
178attempt to change the control will result in an <span class="errorcode">EINVAL</span> error code.</td></tr><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_UPDATE</code></td><td valign="top">0x0008</td><td valign="top">A hint that changing this control may affect the
179value of other controls within the same control class. Applications
180should update their user interface accordingly.</td></tr><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_INACTIVE</code></td><td valign="top">0x0010</td><td valign="top">This control is not applicable to the current
181configuration and should be displayed accordingly in a user interface.
182For example the flag may be set on a MPEG audio level 2 bitrate
183control when MPEG audio encoding level 1 was selected with another
184control.</td></tr><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_SLIDER</code></td><td valign="top">0x0020</td><td valign="top">A hint that this control is best represented as a
185slider-like element in a user interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_WRITE_ONLY</code></td><td valign="top">0x0040</td><td valign="top">This control is permanently writable only. Any
186attempt to read the control will result in an <span class="errorcode">EACCES</span> error code error code. This
187flag is typically present for relative controls or action controls where
188writing a value will cause the device to carry out a given action
189(e.&#160;g. motor control) but no meaningful value can be returned.</td></tr><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_VOLATILE</code></td><td valign="top">0x0080</td><td valign="top">This control is volatile, which means that the value of the control
190changes continuously. A typical example would be the current gain value if the device
191is in auto-gain mode. In such a case the hardware calculates the gain value based on
192the lighting conditions which can change over time. Note that setting a new value for
193a volatile control will have no effect and no <code class="constant">V4L2_EVENT_CTRL_CH_VALUE</code>
194will be sent, unless the <code class="constant">V4L2_CTRL_FLAG_EXECUTE_ON_WRITE</code> flag
195(see below) is also set. Otherwise the new value will just be ignored.</td></tr><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_HAS_PAYLOAD</code></td><td valign="top">0x0100</td><td valign="top">This control has a pointer type, so its value has to be accessed
196using one of the pointer fields of struct&#160;<a class="link" href="vidioc-g-ext-ctrls.html#v4l2-ext-control" title="Table&#160;A.66.&#160;struct v4l2_ext_control">v4l2_ext_control</a>. This flag is set for controls
197that are an array, string, or have a compound type. In all cases you have to set a
198pointer to memory containing the payload of the control.</td></tr><tr><td valign="top"><code class="constant">V4L2_CTRL_FLAG_EXECUTE_ON_WRITE</code></td><td valign="top">0x0200</td><td valign="top">The value provided to the control will be propagated to the driver
199even if remains constant. This is required when the control represents an action
200on the hardware. For example: clearing an error flag or triggering the flash. All the
201controls of the type <code class="constant">V4L2_CTRL_TYPE_BUTTON</code> have this flag set.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect1"><a name="idp1116041484"></a><h2>Return Value</h2><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table&#160;19.1.&#160;Generic error codes">Generic Error Codes</a> chapter.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">EINVAL</span></span></dt><dd><p>The struct&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table&#160;A.95.&#160;struct v4l2_queryctrl">v4l2_queryctrl</a> <em class="structfield"><code>id</code></em>
202is invalid. The struct&#160;<a class="link" href="vidioc-queryctrl.html#v4l2-querymenu" title="Table&#160;A.97.&#160;struct v4l2_querymenu">v4l2_querymenu</a> <em class="structfield"><code>id</code></em> is
203invalid or <em class="structfield"><code>index</code></em> is out of range (less than
204<em class="structfield"><code>minimum</code></em> or greater than <em class="structfield"><code>maximum</code></em>)
205or this particular menu item is not supported by the driver.</p></dd><dt><span class="term"><span class="errorcode">EACCES</span></span></dt><dd><p>An attempt was made to read a write-only control.</p></dd></dl></div></div><div class="footnotes"><br><hr style="width:100; text-align:left;margin-left: 0"><div id="ftn.idp1115934660" class="footnote"><p><a href="#idp1115934660" class="para"><sup class="para">[19] </sup></a><code class="constant">V4L2_CTRL_FLAG_DISABLED</code> was
206intended for two purposes: Drivers can skip predefined controls not
207supported by the hardware (although returning EINVAL would do as
208well), or disable predefined and private controls after hardware
209detection without the trouble of reordering control arrays and indices
210(EINVAL cannot be used to skip private controls because it would
211prematurely end the enumeration).</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="vidioc-querycap.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="user-func.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="vidioc-query-dv-timings.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_QUERYCAP&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;ioctl VIDIOC_QUERY_DV_TIMINGS</td></tr></table></div></body></html>
212