1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><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 A. 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> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <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 — 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> </td><td>int <var class="pdparam">request</var>, </td></tr><tr><td> </td><td>struct v4l2_queryctrl *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </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> </td><td>int <var class="pdparam">request</var>, </td></tr><tr><td> </td><td>struct v4l2_query_ext_ctrl *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </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> </td><td>int <var class="pdparam">request</var>, </td></tr><tr><td> </td><td>struct v4l2_querymenu *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id-1.4.11.50.4"></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="id-1.4.11.50.5"></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 <a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table A.95. 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.id-1.4.11.50.5.4.3" class="footnote" name="id-1.4.11.50.5.4.3"><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 ≥ <code class="constant">V4L2_CTRL_COMPOUND_TYPES</code> and/or array 24control, in other words controls that contain more than one value). 25Specify both <code class="constant">V4L2_CTRL_FLAG_NEXT_CTRL</code> and 26<code class="constant">V4L2_CTRL_FLAG_NEXT_COMPOUND</code> in order to enumerate 27all controls, compound or not. Drivers which do not support these flags yet 28always return <span class="errorcode">EINVAL</span>.</p><p>The <code class="constant">VIDIOC_QUERY_EXT_CTRL</code> ioctl was 29introduced in order to better support controls that can use compound 30types, and to expose additional control information that cannot be 31returned in struct <a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table A.95. 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 32same way as <code class="constant">VIDIOC_QUERYCTRL</code>, except that the 33<em class="structfield"><code>reserved</code></em> array must be zeroed as well.</p><p>Additional information is required for menu controls: the 34names of the menu items. To query them applications set the 35<em class="structfield"><code>id</code></em> and <em class="structfield"><code>index</code></em> 36fields of struct <a class="link" href="vidioc-queryctrl.html#v4l2-querymenu" title="Table A.97. struct v4l2_querymenu">v4l2_querymenu</a> and call the 37<code class="constant">VIDIOC_QUERYMENU</code> ioctl with a pointer to this 38structure. The driver fills the rest of the structure or returns an 39<span class="errorcode">EINVAL</span> error code when the <em class="structfield"><code>id</code></em> or 40<em class="structfield"><code>index</code></em> is invalid. Menu items are enumerated 41by calling <code class="constant">VIDIOC_QUERYMENU</code> with successive 42<em class="structfield"><code>index</code></em> values from struct <a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table A.95. struct v4l2_queryctrl">v4l2_queryctrl</a> 43<em class="structfield"><code>minimum</code></em> to 44<em class="structfield"><code>maximum</code></em>, inclusive. Note that it is possible 45for <code class="constant">VIDIOC_QUERYMENU</code> to return an <span class="errorcode">EINVAL</span> error code for some 46indices between <em class="structfield"><code>minimum</code></em> and <em class="structfield"><code>maximum</code></em>. 47In that case that particular menu item is not supported by this driver. Also note that 48the <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 “User Controls”</a>.</p><div class="table"><a name="v4l2-queryctrl"></a><p class="title"><b>Table A.95. 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 49<a class="xref" href="control.html#control-id" title="Table 1.1. Control IDs">Table 1.1, “Control IDs”</a> for predefined IDs. When the ID is ORed 50with V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and returns 51the first control with a higher ID. Drivers which do not support this 52flag 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 A.98. enum v4l2_ctrl_type">Table A.98, “enum v4l2_ctrl_type”</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 53string. 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 54bound for the control. See enum <a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table A.98. enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the minimum value is to 55be 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 56bound for the control. See enum <a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table A.98. enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the maximum value is to 57be 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. 58See enum <a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table A.98. enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the step value is to be used for each possible 59control type. Note that this an unsigned 32-bit value. 60</p><p>Generally drivers should not scale hardware 61control values. It may be necessary for example when the 62<em class="structfield"><code>name</code></em> or <em class="structfield"><code>id</code></em> imply 63a particular unit and the hardware actually accepts only multiples of 64said unit. If so, drivers must take care values are properly rounded 65when scaling, such that errors will not accumulate on repeated 66read-write cycles.</p><p>This field gives the smallest change of 67an integer control actually affecting hardware. Often the information 68is needed when the user can change controls by keyboard or GUI 69buttons, rather than a slider. When for example a hardware register 70accepts values 0-511 and the driver reports 0-65535, step should be 71128.</p><p>Note that although signed, the step value is supposed to 72be 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 73<code class="constant">V4L2_CTRL_TYPE_INTEGER</code>, 74<code class="constant">_BOOLEAN</code>, <code class="constant">_BITMASK</code>, 75<code class="constant">_MENU</code> or <code class="constant">_INTEGER_MENU</code> control. 76Not valid for other types of controls. 77Note that drivers reset controls to their default value only when the 78driver 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 A.99. Control Flags">Table A.99, “Control Flags”</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 79the 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 A.96. 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 80<a class="xref" href="control.html#control-id" title="Table 1.1. Control IDs">Table 1.1, “Control IDs”</a> for predefined IDs. When the ID is ORed 81with <code class="constant">V4L2_CTRL_FLAG_NEXT_CTRL</code> the driver clears the 82flag and returns the first non-compound control with a higher ID. When the 83ID is ORed with <code class="constant">V4L2_CTRL_FLAG_NEXT_COMPOUND</code> the driver 84clears the flag and returns the first compound control with a higher ID. 85Set 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 A.98. enum v4l2_ctrl_type">Table A.98, “enum v4l2_ctrl_type”</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 86string. 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 87bound for the control. See enum <a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table A.98. enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the minimum value is to 88be 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 89bound for the control. See enum <a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table A.98. enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the maximum value is to 90be 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. 91See enum <a class="link" href="vidioc-queryctrl.html#v4l2-ctrl-type" title="Table A.98. enum v4l2_ctrl_type">v4l2_ctrl_type</a> how the step value is to be used for each possible 92control type. Note that this an unsigned 64-bit value. 93</p><p>Generally drivers should not scale hardware 94control values. It may be necessary for example when the 95<em class="structfield"><code>name</code></em> or <em class="structfield"><code>id</code></em> imply 96a particular unit and the hardware actually accepts only multiples of 97said unit. If so, drivers must take care values are properly rounded 98when scaling, such that errors will not accumulate on repeated 99read-write cycles.</p><p>This field gives the smallest change of 100an integer control actually affecting hardware. Often the information 101is needed when the user can change controls by keyboard or GUI 102buttons, rather than a slider. When for example a hardware register 103accepts values 0-511 and the driver reports 0-65535, step should be 104128.</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 105<code class="constant">V4L2_CTRL_TYPE_INTEGER</code>, <code class="constant">_INTEGER64</code>, 106<code class="constant">_BOOLEAN</code>, <code class="constant">_BITMASK</code>, 107<code class="constant">_MENU</code>, <code class="constant">_INTEGER_MENU</code>, 108<code class="constant">_U8</code> or <code class="constant">_U16</code> control. 109Not valid for other types of controls. 110Note that drivers reset controls to their default value only when the 111driver is first loaded, never afterwards. 112</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 A.99. Control Flags">Table A.99, “Control Flags”</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. 113Given a char pointer <code class="constant">p</code> to a 3-dimensional array you can find the 114position of cell <code class="constant">(z, y, x)</code> as follows: 115<code class="constant">p + ((z * dims[1] + y) * dims[0] + x) * elem_size</code>. <em class="structfield"><code>elem_size</code></em> 116is always valid, also when the control isn't an array. For string controls 117<em class="structfield"><code>elem_size</code></em> is equal to <em class="structfield"><code>maximum + 1</code></em>. 118</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 119is not an array, then <em class="structfield"><code>elems</code></em> is 1. The <em class="structfield"><code>elems</code></em> 120field 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 121is 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> 122elements 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 123must 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 A.97. 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"> </td><td valign="top"><em class="structfield"><code>id</code></em></td><td valign="top">Identifies the control, set by the application 124from the respective struct <a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table A.95. struct v4l2_queryctrl">v4l2_queryctrl</a> 125<em class="structfield"><code>id</code></em>.</td></tr><tr><td valign="top">__u32</td><td valign="top"> </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 126 the application.</td></tr><tr><td valign="top">union</td><td valign="top"> </td><td valign="top"> </td><td valign="top"> </td></tr><tr><td valign="top"> </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 127string. This information is intended for the user. This field is valid 128for <code class="constant">V4L2_CTRL_FLAG_MENU</code> type controls.</td></tr><tr><td valign="top"> </td><td valign="top">__s64</td><td valign="top"><em class="structfield"><code>value</code></em></td><td valign="top"> 129 Value of the integer menu item. This field is valid for 130 <code class="constant">V4L2_CTRL_FLAG_INTEGER_MENU</code> type 131 controls. 132 </td></tr><tr><td valign="top">__u32</td><td valign="top"> </td><td valign="top"><em class="structfield"><code>reserved</code></em></td><td valign="top">Reserved for future extensions. Drivers must set 133the 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 A.98. 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 134maximum inclusive. The step value indicates the increment between 135values.</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 136"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">≥ 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 137the menu items can be enumerated with the 138<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">≥ 0</td><td align="center" valign="top">1</td><td align="center" valign="top">N-1</td><td align="left" valign="top"> 139 The control has a menu of N choices. The values of the 140 menu items can be enumerated with the 141 <code class="constant">VIDIOC_QUERYMENU</code> ioctl. This is 142 similar to <code class="constant">V4L2_CTRL_TYPE_MENU</code> 143 except that instead of strings, the menu items are 144 signed 64-bit integers. 145 </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 146be used, all other bits are to be 0. The maximum value is interpreted as a __u32, 147allowing 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. 148Drivers must ignore the value passed with 149<code class="constant">VIDIOC_S_CTRL</code> and return an <span class="errorcode">EINVAL</span> error code on a 150<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 151and step size cannot be queried using <code class="constant">VIDIOC_QUERYCTRL</code>. 152Only <code class="constant">VIDIOC_QUERY_EXT_CTRL</code> can retrieve the 64-bit 153min/max/step values, they should be interpreted as n/a when using 154<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">≥ 0</td><td align="center" valign="top">≥ 1</td><td align="center" valign="top">≥ 0</td><td align="left" valign="top">The minimum and maximum string lengths. The step size 155means that the string must be (minimum + N * step) characters long for 156N ≥ 0. These lengths do not include the terminating zero, so in order to 157pass 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 158<em class="structfield"><code>size</code></em> field of struct <a class="link" href="vidioc-g-ext-ctrls.html#v4l2-ext-control" title="Table A.66. 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 159set the <em class="structfield"><code>size</code></em> field to <em class="structfield"><code>maximum</code></em> + 1. 160Which character encoding is used will depend on the string control itself and 161should 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 162<code class="constant">VIDIOC_QUERYCTRL</code> is called with a control ID 163equal to a control class code (see <a class="xref" href="vidioc-g-ext-ctrls.html#ctrl-class" title="Table A.68. Control classes">Table A.68, “Control classes”</a>) + 1, the 164ioctl returns the name of the control class and this control type. 165Older drivers which do not support this feature return an 166<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 167maximum inclusive. The step value indicates the increment between 168values. 169</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 170maximum inclusive. The step value indicates the increment between 171values. 172</td></tr><tr><td align="left" valign="top"><code class="constant">V4L2_CTRL_TYPE_U32</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 32-bit valued control ranging from minimum to 173maximum inclusive. The step value indicates the increment between 174values. 175</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="control-flags"></a><p class="title"><b>Table A.99. 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 176ignored by the application. Any attempt to change the control will 177result 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 178example because another application took over control of the 179respective resource. Such controls may be displayed specially in a 180user interface. Attempts to change the control may result in an 181<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 182attempt 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 183value of other controls within the same control class. Applications 184should 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 185configuration and should be displayed accordingly in a user interface. 186For example the flag may be set on a MPEG audio level 2 bitrate 187control when MPEG audio encoding level 1 was selected with another 188control.</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 189slider-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 190attempt to read the control will result in an <span class="errorcode">EACCES</span> error code error code. This 191flag is typically present for relative controls or action controls where 192writing a value will cause the device to carry out a given action 193(e. 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 194changes continuously. A typical example would be the current gain value if the device 195is in auto-gain mode. In such a case the hardware calculates the gain value based on 196the lighting conditions which can change over time. Note that setting a new value for 197a volatile control will have no effect and no <code class="constant">V4L2_EVENT_CTRL_CH_VALUE</code> 198will be sent, unless the <code class="constant">V4L2_CTRL_FLAG_EXECUTE_ON_WRITE</code> flag 199(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 200using one of the pointer fields of struct <a class="link" href="vidioc-g-ext-ctrls.html#v4l2-ext-control" title="Table A.66. struct v4l2_ext_control">v4l2_ext_control</a>. This flag is set for controls 201that are an array, string, or have a compound type. In all cases you have to set a 202pointer 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 203even if it remains constant. This is required when the control represents an action 204on the hardware. For example: clearing an error flag or triggering the flash. All the 205controls 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="id-1.4.11.50.6"></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 17.1. 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 <a class="link" href="vidioc-queryctrl.html#v4l2-queryctrl" title="Table A.95. struct v4l2_queryctrl">v4l2_queryctrl</a> <em class="structfield"><code>id</code></em> 206is invalid. The struct <a class="link" href="vidioc-queryctrl.html#v4l2-querymenu" title="Table A.97. struct v4l2_querymenu">v4l2_querymenu</a> <em class="structfield"><code>id</code></em> is 207invalid or <em class="structfield"><code>index</code></em> is out of range (less than 208<em class="structfield"><code>minimum</code></em> or greater than <em class="structfield"><code>maximum</code></em>) 209or 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.id-1.4.11.50.5.4.3" class="footnote"><p><a href="#id-1.4.11.50.5.4.3" class="para"><sup class="para">[19] </sup></a><code class="constant">V4L2_CTRL_FLAG_DISABLED</code> was 210intended for two purposes: Drivers can skip predefined controls not 211supported by the hardware (although returning EINVAL would do as 212well), or disable predefined and private controls after hardware 213detection without the trouble of reordering control arrays and indices 214(EINVAL cannot be used to skip private controls because it would 215prematurely 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> </td><td width="20%" align="center"><a accesskey="u" href="user-func.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="vidioc-query-dv-timings.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_QUERYCAP </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ioctl VIDIOC_QUERY_DV_TIMINGS</td></tr></table></div></body></html> 216