vidioc-queryctrl.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <refentry id="vidioc-queryctrl">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>VIDIOC_QUERYCTRL</refname>
  8. <refname>VIDIOC_QUERY_EXT_CTRL</refname>
  9. <refname>VIDIOC_QUERYMENU</refname>
  10. <refpurpose>Enumerate controls and menu control items</refpurpose>
  11. </refnamediv>
  12. <refsynopsisdiv>
  13. <funcsynopsis>
  14. <funcprototype>
  15. <funcdef>int <function>ioctl</function></funcdef>
  16. <paramdef>int <parameter>fd</parameter></paramdef>
  17. <paramdef>int <parameter>request</parameter></paramdef>
  18. <paramdef>struct v4l2_queryctrl *<parameter>argp</parameter></paramdef>
  19. </funcprototype>
  20. </funcsynopsis>
  21. <funcsynopsis>
  22. <funcprototype>
  23. <funcdef>int <function>ioctl</function></funcdef>
  24. <paramdef>int <parameter>fd</parameter></paramdef>
  25. <paramdef>int <parameter>request</parameter></paramdef>
  26. <paramdef>struct v4l2_query_ext_ctrl *<parameter>argp</parameter></paramdef>
  27. </funcprototype>
  28. </funcsynopsis>
  29. <funcsynopsis>
  30. <funcprototype>
  31. <funcdef>int <function>ioctl</function></funcdef>
  32. <paramdef>int <parameter>fd</parameter></paramdef>
  33. <paramdef>int <parameter>request</parameter></paramdef>
  34. <paramdef>struct v4l2_querymenu *<parameter>argp</parameter></paramdef>
  35. </funcprototype>
  36. </funcsynopsis>
  37. </refsynopsisdiv>
  38. <refsect1>
  39. <title>Arguments</title>
  40. <variablelist>
  41. <varlistentry>
  42. <term><parameter>fd</parameter></term>
  43. <listitem>
  44. <para>&fd;</para>
  45. </listitem>
  46. </varlistentry>
  47. <varlistentry>
  48. <term><parameter>request</parameter></term>
  49. <listitem>
  50. <para>VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU</para>
  51. </listitem>
  52. </varlistentry>
  53. <varlistentry>
  54. <term><parameter>argp</parameter></term>
  55. <listitem>
  56. <para></para>
  57. </listitem>
  58. </varlistentry>
  59. </variablelist>
  60. </refsect1>
  61. <refsect1>
  62. <title>Description</title>
  63. <para>To query the attributes of a control applications set the
  64. <structfield>id</structfield> field of a &v4l2-queryctrl; and call the
  65. <constant>VIDIOC_QUERYCTRL</constant> ioctl with a pointer to this
  66. structure. The driver fills the rest of the structure or returns an
  67. &EINVAL; when the <structfield>id</structfield> is invalid.</para>
  68. <para>It is possible to enumerate controls by calling
  69. <constant>VIDIOC_QUERYCTRL</constant> with successive
  70. <structfield>id</structfield> values starting from
  71. <constant>V4L2_CID_BASE</constant> up to and exclusive
  72. <constant>V4L2_CID_LASTP1</constant>. Drivers may return
  73. <errorcode>EINVAL</errorcode> if a control in this range is not
  74. supported. Further applications can enumerate private controls, which
  75. are not defined in this specification, by starting at
  76. <constant>V4L2_CID_PRIVATE_BASE</constant> and incrementing
  77. <structfield>id</structfield> until the driver returns
  78. <errorcode>EINVAL</errorcode>.</para>
  79. <para>In both cases, when the driver sets the
  80. <constant>V4L2_CTRL_FLAG_DISABLED</constant> flag in the
  81. <structfield>flags</structfield> field this control is permanently
  82. disabled and should be ignored by the application.<footnote>
  83. <para><constant>V4L2_CTRL_FLAG_DISABLED</constant> was
  84. intended for two purposes: Drivers can skip predefined controls not
  85. supported by the hardware (although returning EINVAL would do as
  86. well), or disable predefined and private controls after hardware
  87. detection without the trouble of reordering control arrays and indices
  88. (EINVAL cannot be used to skip private controls because it would
  89. prematurely end the enumeration).</para></footnote></para>
  90. <para>When the application ORs <structfield>id</structfield> with
  91. <constant>V4L2_CTRL_FLAG_NEXT_CTRL</constant> the driver returns the
  92. next supported non-compound control, or <errorcode>EINVAL</errorcode>
  93. if there is none. In addition, the <constant>V4L2_CTRL_FLAG_NEXT_COMPOUND</constant>
  94. flag can be specified to enumerate all compound controls (i.e. controls
  95. with type &ge; <constant>V4L2_CTRL_COMPOUND_TYPES</constant> and/or array
  96. control, in other words controls that contain more than one value).
  97. Specify both <constant>V4L2_CTRL_FLAG_NEXT_CTRL</constant> and
  98. <constant>V4L2_CTRL_FLAG_NEXT_COMPOUND</constant> in order to enumerate
  99. all controls, compound or not. Drivers which do not support these flags yet
  100. always return <errorcode>EINVAL</errorcode>.</para>
  101. <para>The <constant>VIDIOC_QUERY_EXT_CTRL</constant> ioctl was
  102. introduced in order to better support controls that can use compound
  103. types, and to expose additional control information that cannot be
  104. returned in &v4l2-queryctrl; since that structure is full.</para>
  105. <para><constant>VIDIOC_QUERY_EXT_CTRL</constant> is used in the
  106. same way as <constant>VIDIOC_QUERYCTRL</constant>, except that the
  107. <structfield>reserved</structfield> array must be zeroed as well.</para>
  108. <para>Additional information is required for menu controls: the
  109. names of the menu items. To query them applications set the
  110. <structfield>id</structfield> and <structfield>index</structfield>
  111. fields of &v4l2-querymenu; and call the
  112. <constant>VIDIOC_QUERYMENU</constant> ioctl with a pointer to this
  113. structure. The driver fills the rest of the structure or returns an
  114. &EINVAL; when the <structfield>id</structfield> or
  115. <structfield>index</structfield> is invalid. Menu items are enumerated
  116. by calling <constant>VIDIOC_QUERYMENU</constant> with successive
  117. <structfield>index</structfield> values from &v4l2-queryctrl;
  118. <structfield>minimum</structfield> to
  119. <structfield>maximum</structfield>, inclusive. Note that it is possible
  120. for <constant>VIDIOC_QUERYMENU</constant> to return an &EINVAL; for some
  121. indices between <structfield>minimum</structfield> and <structfield>maximum</structfield>.
  122. In that case that particular menu item is not supported by this driver. Also note that
  123. the <structfield>minimum</structfield> value is not necessarily 0.</para>
  124. <para>See also the examples in <xref linkend="control" />.</para>
  125. <table pgwide="1" frame="none" id="v4l2-queryctrl">
  126. <title>struct <structname>v4l2_queryctrl</structname></title>
  127. <tgroup cols="3">
  128. &cs-str;
  129. <tbody valign="top">
  130. <row>
  131. <entry>__u32</entry>
  132. <entry><structfield>id</structfield></entry>
  133. <entry>Identifies the control, set by the application. See
  134. <xref linkend="control-id" /> for predefined IDs. When the ID is ORed
  135. with V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and returns
  136. the first control with a higher ID. Drivers which do not support this
  137. flag yet always return an &EINVAL;.</entry>
  138. </row>
  139. <row>
  140. <entry>__u32</entry>
  141. <entry><structfield>type</structfield></entry>
  142. <entry>Type of control, see <xref
  143. linkend="v4l2-ctrl-type" />.</entry>
  144. </row>
  145. <row>
  146. <entry>__u8</entry>
  147. <entry><structfield>name</structfield>[32]</entry>
  148. <entry>Name of the control, a NUL-terminated ASCII
  149. string. This information is intended for the user.</entry>
  150. </row>
  151. <row>
  152. <entry>__s32</entry>
  153. <entry><structfield>minimum</structfield></entry>
  154. <entry>Minimum value, inclusive. This field gives a lower
  155. bound for the control. See &v4l2-ctrl-type; how the minimum value is to
  156. be used for each possible control type. Note that this a signed 32-bit value.</entry>
  157. </row>
  158. <row>
  159. <entry>__s32</entry>
  160. <entry><structfield>maximum</structfield></entry>
  161. <entry>Maximum value, inclusive. This field gives an upper
  162. bound for the control. See &v4l2-ctrl-type; how the maximum value is to
  163. be used for each possible control type. Note that this a signed 32-bit value.</entry>
  164. </row>
  165. <row>
  166. <entry>__s32</entry>
  167. <entry><structfield>step</structfield></entry>
  168. <entry><para>This field gives a step size for the control.
  169. See &v4l2-ctrl-type; how the step value is to be used for each possible
  170. control type. Note that this an unsigned 32-bit value.
  171. </para><para>Generally drivers should not scale hardware
  172. control values. It may be necessary for example when the
  173. <structfield>name</structfield> or <structfield>id</structfield> imply
  174. a particular unit and the hardware actually accepts only multiples of
  175. said unit. If so, drivers must take care values are properly rounded
  176. when scaling, such that errors will not accumulate on repeated
  177. read-write cycles.</para><para>This field gives the smallest change of
  178. an integer control actually affecting hardware. Often the information
  179. is needed when the user can change controls by keyboard or GUI
  180. buttons, rather than a slider. When for example a hardware register
  181. accepts values 0-511 and the driver reports 0-65535, step should be
  182. 128.</para><para>Note that although signed, the step value is supposed to
  183. be always positive.</para></entry>
  184. </row>
  185. <row>
  186. <entry>__s32</entry>
  187. <entry><structfield>default_value</structfield></entry>
  188. <entry>The default value of a
  189. <constant>V4L2_CTRL_TYPE_INTEGER</constant>,
  190. <constant>_BOOLEAN</constant>, <constant>_BITMASK</constant>,
  191. <constant>_MENU</constant> or <constant>_INTEGER_MENU</constant> control.
  192. Not valid for other types of controls.
  193. Note that drivers reset controls to their default value only when the
  194. driver is first loaded, never afterwards.</entry>
  195. </row>
  196. <row>
  197. <entry>__u32</entry>
  198. <entry><structfield>flags</structfield></entry>
  199. <entry>Control flags, see <xref
  200. linkend="control-flags" />.</entry>
  201. </row>
  202. <row>
  203. <entry>__u32</entry>
  204. <entry><structfield>reserved</structfield>[2]</entry>
  205. <entry>Reserved for future extensions. Drivers must set
  206. the array to zero.</entry>
  207. </row>
  208. </tbody>
  209. </tgroup>
  210. </table>
  211. <table pgwide="1" frame="none" id="v4l2-query-ext-ctrl">
  212. <title>struct <structname>v4l2_query_ext_ctrl</structname></title>
  213. <tgroup cols="3">
  214. &cs-str;
  215. <tbody valign="top">
  216. <row>
  217. <entry>__u32</entry>
  218. <entry><structfield>id</structfield></entry>
  219. <entry>Identifies the control, set by the application. See
  220. <xref linkend="control-id" /> for predefined IDs. When the ID is ORed
  221. with <constant>V4L2_CTRL_FLAG_NEXT_CTRL</constant> the driver clears the
  222. flag and returns the first non-compound control with a higher ID. When the
  223. ID is ORed with <constant>V4L2_CTRL_FLAG_NEXT_COMPOUND</constant> the driver
  224. clears the flag and returns the first compound control with a higher ID.
  225. Set both to get the first control (compound or not) with a higher ID.</entry>
  226. </row>
  227. <row>
  228. <entry>__u32</entry>
  229. <entry><structfield>type</structfield></entry>
  230. <entry>Type of control, see <xref
  231. linkend="v4l2-ctrl-type" />.</entry>
  232. </row>
  233. <row>
  234. <entry>char</entry>
  235. <entry><structfield>name</structfield>[32]</entry>
  236. <entry>Name of the control, a NUL-terminated ASCII
  237. string. This information is intended for the user.</entry>
  238. </row>
  239. <row>
  240. <entry>__s64</entry>
  241. <entry><structfield>minimum</structfield></entry>
  242. <entry>Minimum value, inclusive. This field gives a lower
  243. bound for the control. See &v4l2-ctrl-type; how the minimum value is to
  244. be used for each possible control type. Note that this a signed 64-bit value.</entry>
  245. </row>
  246. <row>
  247. <entry>__s64</entry>
  248. <entry><structfield>maximum</structfield></entry>
  249. <entry>Maximum value, inclusive. This field gives an upper
  250. bound for the control. See &v4l2-ctrl-type; how the maximum value is to
  251. be used for each possible control type. Note that this a signed 64-bit value.</entry>
  252. </row>
  253. <row>
  254. <entry>__u64</entry>
  255. <entry><structfield>step</structfield></entry>
  256. <entry><para>This field gives a step size for the control.
  257. See &v4l2-ctrl-type; how the step value is to be used for each possible
  258. control type. Note that this an unsigned 64-bit value.
  259. </para><para>Generally drivers should not scale hardware
  260. control values. It may be necessary for example when the
  261. <structfield>name</structfield> or <structfield>id</structfield> imply
  262. a particular unit and the hardware actually accepts only multiples of
  263. said unit. If so, drivers must take care values are properly rounded
  264. when scaling, such that errors will not accumulate on repeated
  265. read-write cycles.</para><para>This field gives the smallest change of
  266. an integer control actually affecting hardware. Often the information
  267. is needed when the user can change controls by keyboard or GUI
  268. buttons, rather than a slider. When for example a hardware register
  269. accepts values 0-511 and the driver reports 0-65535, step should be
  270. 128.</para></entry>
  271. </row>
  272. <row>
  273. <entry>__s64</entry>
  274. <entry><structfield>default_value</structfield></entry>
  275. <entry>The default value of a
  276. <constant>V4L2_CTRL_TYPE_INTEGER</constant>, <constant>_INTEGER64</constant>,
  277. <constant>_BOOLEAN</constant>, <constant>_BITMASK</constant>,
  278. <constant>_MENU</constant>, <constant>_INTEGER_MENU</constant>,
  279. <constant>_U8</constant> or <constant>_U16</constant> control.
  280. Not valid for other types of controls.
  281. Note that drivers reset controls to their default value only when the
  282. driver is first loaded, never afterwards.
  283. </entry>
  284. </row>
  285. <row>
  286. <entry>__u32</entry>
  287. <entry><structfield>flags</structfield></entry>
  288. <entry>Control flags, see <xref
  289. linkend="control-flags" />.</entry>
  290. </row>
  291. <row>
  292. <entry>__u32</entry>
  293. <entry><structfield>elem_size</structfield></entry>
  294. <entry>The size in bytes of a single element of the array.
  295. Given a char pointer <constant>p</constant> to a 3-dimensional array you can find the
  296. position of cell <constant>(z, y, x)</constant> as follows:
  297. <constant>p + ((z * dims[1] + y) * dims[0] + x) * elem_size</constant>. <structfield>elem_size</structfield>
  298. is always valid, also when the control isn't an array. For string controls
  299. <structfield>elem_size</structfield> is equal to <structfield>maximum + 1</structfield>.
  300. </entry>
  301. </row>
  302. <row>
  303. <entry>__u32</entry>
  304. <entry><structfield>elems</structfield></entry>
  305. <entry>The number of elements in the N-dimensional array. If this control
  306. is not an array, then <structfield>elems</structfield> is 1. The <structfield>elems</structfield>
  307. field can never be 0.</entry>
  308. </row>
  309. <row>
  310. <entry>__u32</entry>
  311. <entry><structfield>nr_of_dims</structfield></entry>
  312. <entry>The number of dimension in the N-dimensional array. If this control
  313. is not an array, then this field is 0.</entry>
  314. </row>
  315. <row>
  316. <entry>__u32</entry>
  317. <entry><structfield>dims[V4L2_CTRL_MAX_DIMS]</structfield></entry>
  318. <entry>The size of each dimension. The first <structfield>nr_of_dims</structfield>
  319. elements of this array must be non-zero, all remaining elements must be zero.</entry>
  320. </row>
  321. <row>
  322. <entry>__u32</entry>
  323. <entry><structfield>reserved</structfield>[32]</entry>
  324. <entry>Reserved for future extensions. Applications and drivers
  325. must set the array to zero.</entry>
  326. </row>
  327. </tbody>
  328. </tgroup>
  329. </table>
  330. <table pgwide="1" frame="none" id="v4l2-querymenu">
  331. <title>struct <structname>v4l2_querymenu</structname></title>
  332. <tgroup cols="4">
  333. &cs-str;
  334. <tbody valign="top">
  335. <row>
  336. <entry>__u32</entry>
  337. <entry></entry>
  338. <entry><structfield>id</structfield></entry>
  339. <entry>Identifies the control, set by the application
  340. from the respective &v4l2-queryctrl;
  341. <structfield>id</structfield>.</entry>
  342. </row>
  343. <row>
  344. <entry>__u32</entry>
  345. <entry></entry>
  346. <entry><structfield>index</structfield></entry>
  347. <entry>Index of the menu item, starting at zero, set by
  348. the application.</entry>
  349. </row>
  350. <row>
  351. <entry>union</entry>
  352. <entry></entry>
  353. <entry></entry>
  354. <entry></entry>
  355. </row>
  356. <row>
  357. <entry></entry>
  358. <entry>__u8</entry>
  359. <entry><structfield>name</structfield>[32]</entry>
  360. <entry>Name of the menu item, a NUL-terminated ASCII
  361. string. This information is intended for the user. This field is valid
  362. for <constant>V4L2_CTRL_FLAG_MENU</constant> type controls.</entry>
  363. </row>
  364. <row>
  365. <entry></entry>
  366. <entry>__s64</entry>
  367. <entry><structfield>value</structfield></entry>
  368. <entry>
  369. Value of the integer menu item. This field is valid for
  370. <constant>V4L2_CTRL_FLAG_INTEGER_MENU</constant> type
  371. controls.
  372. </entry>
  373. </row>
  374. <row>
  375. <entry>__u32</entry>
  376. <entry></entry>
  377. <entry><structfield>reserved</structfield></entry>
  378. <entry>Reserved for future extensions. Drivers must set
  379. the array to zero.</entry>
  380. </row>
  381. </tbody>
  382. </tgroup>
  383. </table>
  384. <table pgwide="1" frame="none" id="v4l2-ctrl-type">
  385. <title>enum v4l2_ctrl_type</title>
  386. <tgroup cols="5" align="left">
  387. <colspec colwidth="30*" />
  388. <colspec colwidth="5*" align="center" />
  389. <colspec colwidth="5*" align="center" />
  390. <colspec colwidth="5*" align="center" />
  391. <colspec colwidth="55*" />
  392. <thead>
  393. <row>
  394. <entry>Type</entry>
  395. <entry><structfield>minimum</structfield></entry>
  396. <entry><structfield>step</structfield></entry>
  397. <entry><structfield>maximum</structfield></entry>
  398. <entry>Description</entry>
  399. </row>
  400. </thead>
  401. <tbody valign="top">
  402. <row>
  403. <entry><constant>V4L2_CTRL_TYPE_INTEGER</constant></entry>
  404. <entry>any</entry>
  405. <entry>any</entry>
  406. <entry>any</entry>
  407. <entry>An integer-valued control ranging from minimum to
  408. maximum inclusive. The step value indicates the increment between
  409. values.</entry>
  410. </row>
  411. <row>
  412. <entry><constant>V4L2_CTRL_TYPE_BOOLEAN</constant></entry>
  413. <entry>0</entry>
  414. <entry>1</entry>
  415. <entry>1</entry>
  416. <entry>A boolean-valued control. Zero corresponds to
  417. "disabled", and one means "enabled".</entry>
  418. </row>
  419. <row>
  420. <entry><constant>V4L2_CTRL_TYPE_MENU</constant></entry>
  421. <entry>&ge; 0</entry>
  422. <entry>1</entry>
  423. <entry>N-1</entry>
  424. <entry>The control has a menu of N choices. The names of
  425. the menu items can be enumerated with the
  426. <constant>VIDIOC_QUERYMENU</constant> ioctl.</entry>
  427. </row>
  428. <row>
  429. <entry><constant>V4L2_CTRL_TYPE_INTEGER_MENU</constant></entry>
  430. <entry>&ge; 0</entry>
  431. <entry>1</entry>
  432. <entry>N-1</entry>
  433. <entry>
  434. The control has a menu of N choices. The values of the
  435. menu items can be enumerated with the
  436. <constant>VIDIOC_QUERYMENU</constant> ioctl. This is
  437. similar to <constant>V4L2_CTRL_TYPE_MENU</constant>
  438. except that instead of strings, the menu items are
  439. signed 64-bit integers.
  440. </entry>
  441. </row>
  442. <row>
  443. <entry><constant>V4L2_CTRL_TYPE_BITMASK</constant></entry>
  444. <entry>0</entry>
  445. <entry>n/a</entry>
  446. <entry>any</entry>
  447. <entry>A bitmask field. The maximum value is the set of bits that can
  448. be used, all other bits are to be 0. The maximum value is interpreted as a __u32,
  449. allowing the use of bit 31 in the bitmask.</entry>
  450. </row>
  451. <row>
  452. <entry><constant>V4L2_CTRL_TYPE_BUTTON</constant></entry>
  453. <entry>0</entry>
  454. <entry>0</entry>
  455. <entry>0</entry>
  456. <entry>A control which performs an action when set.
  457. Drivers must ignore the value passed with
  458. <constant>VIDIOC_S_CTRL</constant> and return an &EINVAL; on a
  459. <constant>VIDIOC_G_CTRL</constant> attempt.</entry>
  460. </row>
  461. <row>
  462. <entry><constant>V4L2_CTRL_TYPE_INTEGER64</constant></entry>
  463. <entry>any</entry>
  464. <entry>any</entry>
  465. <entry>any</entry>
  466. <entry>A 64-bit integer valued control. Minimum, maximum
  467. and step size cannot be queried using <constant>VIDIOC_QUERYCTRL</constant>.
  468. Only <constant>VIDIOC_QUERY_EXT_CTRL</constant> can retrieve the 64-bit
  469. min/max/step values, they should be interpreted as n/a when using
  470. <constant>VIDIOC_QUERYCTRL</constant>.</entry>
  471. </row>
  472. <row>
  473. <entry><constant>V4L2_CTRL_TYPE_STRING</constant></entry>
  474. <entry>&ge; 0</entry>
  475. <entry>&ge; 1</entry>
  476. <entry>&ge; 0</entry>
  477. <entry>The minimum and maximum string lengths. The step size
  478. means that the string must be (minimum + N * step) characters long for
  479. N &ge; 0. These lengths do not include the terminating zero, so in order to
  480. pass a string of length 8 to &VIDIOC-S-EXT-CTRLS; you need to set the
  481. <structfield>size</structfield> field of &v4l2-ext-control; to 9. For &VIDIOC-G-EXT-CTRLS; you can
  482. set the <structfield>size</structfield> field to <structfield>maximum</structfield> + 1.
  483. Which character encoding is used will depend on the string control itself and
  484. should be part of the control documentation.</entry>
  485. </row>
  486. <row>
  487. <entry><constant>V4L2_CTRL_TYPE_CTRL_CLASS</constant></entry>
  488. <entry>n/a</entry>
  489. <entry>n/a</entry>
  490. <entry>n/a</entry>
  491. <entry>This is not a control. When
  492. <constant>VIDIOC_QUERYCTRL</constant> is called with a control ID
  493. equal to a control class code (see <xref linkend="ctrl-class" />) + 1, the
  494. ioctl returns the name of the control class and this control type.
  495. Older drivers which do not support this feature return an
  496. &EINVAL;.</entry>
  497. </row>
  498. <row>
  499. <entry><constant>V4L2_CTRL_TYPE_U8</constant></entry>
  500. <entry>any</entry>
  501. <entry>any</entry>
  502. <entry>any</entry>
  503. <entry>An unsigned 8-bit valued control ranging from minimum to
  504. maximum inclusive. The step value indicates the increment between
  505. values.
  506. </entry>
  507. </row>
  508. <row>
  509. <entry><constant>V4L2_CTRL_TYPE_U16</constant></entry>
  510. <entry>any</entry>
  511. <entry>any</entry>
  512. <entry>any</entry>
  513. <entry>An unsigned 16-bit valued control ranging from minimum to
  514. maximum inclusive. The step value indicates the increment between
  515. values.
  516. </entry>
  517. </row>
  518. <row>
  519. <entry><constant>V4L2_CTRL_TYPE_U32</constant></entry>
  520. <entry>any</entry>
  521. <entry>any</entry>
  522. <entry>any</entry>
  523. <entry>An unsigned 32-bit valued control ranging from minimum to
  524. maximum inclusive. The step value indicates the increment between
  525. values.
  526. </entry>
  527. </row>
  528. </tbody>
  529. </tgroup>
  530. </table>
  531. <table pgwide="1" frame="none" id="control-flags">
  532. <title>Control Flags</title>
  533. <tgroup cols="3">
  534. &cs-def;
  535. <tbody valign="top">
  536. <row>
  537. <entry><constant>V4L2_CTRL_FLAG_DISABLED</constant></entry>
  538. <entry>0x0001</entry>
  539. <entry>This control is permanently disabled and should be
  540. ignored by the application. Any attempt to change the control will
  541. result in an &EINVAL;.</entry>
  542. </row>
  543. <row>
  544. <entry><constant>V4L2_CTRL_FLAG_GRABBED</constant></entry>
  545. <entry>0x0002</entry>
  546. <entry>This control is temporarily unchangeable, for
  547. example because another application took over control of the
  548. respective resource. Such controls may be displayed specially in a
  549. user interface. Attempts to change the control may result in an
  550. &EBUSY;.</entry>
  551. </row>
  552. <row>
  553. <entry><constant>V4L2_CTRL_FLAG_READ_ONLY</constant></entry>
  554. <entry>0x0004</entry>
  555. <entry>This control is permanently readable only. Any
  556. attempt to change the control will result in an &EINVAL;.</entry>
  557. </row>
  558. <row>
  559. <entry><constant>V4L2_CTRL_FLAG_UPDATE</constant></entry>
  560. <entry>0x0008</entry>
  561. <entry>A hint that changing this control may affect the
  562. value of other controls within the same control class. Applications
  563. should update their user interface accordingly.</entry>
  564. </row>
  565. <row>
  566. <entry><constant>V4L2_CTRL_FLAG_INACTIVE</constant></entry>
  567. <entry>0x0010</entry>
  568. <entry>This control is not applicable to the current
  569. configuration and should be displayed accordingly in a user interface.
  570. For example the flag may be set on a MPEG audio level 2 bitrate
  571. control when MPEG audio encoding level 1 was selected with another
  572. control.</entry>
  573. </row>
  574. <row>
  575. <entry><constant>V4L2_CTRL_FLAG_SLIDER</constant></entry>
  576. <entry>0x0020</entry>
  577. <entry>A hint that this control is best represented as a
  578. slider-like element in a user interface.</entry>
  579. </row>
  580. <row>
  581. <entry><constant>V4L2_CTRL_FLAG_WRITE_ONLY</constant></entry>
  582. <entry>0x0040</entry>
  583. <entry>This control is permanently writable only. Any
  584. attempt to read the control will result in an &EACCES; error code. This
  585. flag is typically present for relative controls or action controls where
  586. writing a value will cause the device to carry out a given action
  587. (&eg; motor control) but no meaningful value can be returned.</entry>
  588. </row>
  589. <row>
  590. <entry><constant>V4L2_CTRL_FLAG_VOLATILE</constant></entry>
  591. <entry>0x0080</entry>
  592. <entry>This control is volatile, which means that the value of the control
  593. changes continuously. A typical example would be the current gain value if the device
  594. is in auto-gain mode. In such a case the hardware calculates the gain value based on
  595. the lighting conditions which can change over time. Note that setting a new value for
  596. a volatile control will have no effect and no <constant>V4L2_EVENT_CTRL_CH_VALUE</constant>
  597. will be sent, unless the <constant>V4L2_CTRL_FLAG_EXECUTE_ON_WRITE</constant> flag
  598. (see below) is also set. Otherwise the new value will just be ignored.</entry>
  599. </row>
  600. <row>
  601. <entry><constant>V4L2_CTRL_FLAG_HAS_PAYLOAD</constant></entry>
  602. <entry>0x0100</entry>
  603. <entry>This control has a pointer type, so its value has to be accessed
  604. using one of the pointer fields of &v4l2-ext-control;. This flag is set for controls
  605. that are an array, string, or have a compound type. In all cases you have to set a
  606. pointer to memory containing the payload of the control.</entry>
  607. </row>
  608. <row>
  609. <entry><constant>V4L2_CTRL_FLAG_EXECUTE_ON_WRITE</constant></entry>
  610. <entry>0x0200</entry>
  611. <entry>The value provided to the control will be propagated to the driver
  612. even if it remains constant. This is required when the control represents an action
  613. on the hardware. For example: clearing an error flag or triggering the flash. All the
  614. controls of the type <constant>V4L2_CTRL_TYPE_BUTTON</constant> have this flag set.</entry>
  615. </row>
  616. </tbody>
  617. </tgroup>
  618. </table>
  619. </refsect1>
  620. <refsect1>
  621. &return-value;
  622. <variablelist>
  623. <varlistentry>
  624. <term><errorcode>EINVAL</errorcode></term>
  625. <listitem>
  626. <para>The &v4l2-queryctrl; <structfield>id</structfield>
  627. is invalid. The &v4l2-querymenu; <structfield>id</structfield> is
  628. invalid or <structfield>index</structfield> is out of range (less than
  629. <structfield>minimum</structfield> or greater than <structfield>maximum</structfield>)
  630. or this particular menu item is not supported by the driver.</para>
  631. </listitem>
  632. </varlistentry>
  633. <varlistentry>
  634. <term><errorcode>EACCES</errorcode></term>
  635. <listitem>
  636. <para>An attempt was made to read a write-only control.</para>
  637. </listitem>
  638. </varlistentry>
  639. </variablelist>
  640. </refsect1>
  641. </refentry>