vidioc-g-ext-ctrls.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <refentry id="vidioc-g-ext-ctrls">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS,
  4. VIDIOC_TRY_EXT_CTRLS</refentrytitle>
  5. &manvol;
  6. </refmeta>
  7. <refnamediv>
  8. <refname>VIDIOC_G_EXT_CTRLS</refname>
  9. <refname>VIDIOC_S_EXT_CTRLS</refname>
  10. <refname>VIDIOC_TRY_EXT_CTRLS</refname>
  11. <refpurpose>Get or set the value of several controls, try control
  12. values</refpurpose>
  13. </refnamediv>
  14. <refsynopsisdiv>
  15. <funcsynopsis>
  16. <funcprototype>
  17. <funcdef>int <function>ioctl</function></funcdef>
  18. <paramdef>int <parameter>fd</parameter></paramdef>
  19. <paramdef>int <parameter>request</parameter></paramdef>
  20. <paramdef>struct v4l2_ext_controls
  21. *<parameter>argp</parameter></paramdef>
  22. </funcprototype>
  23. </funcsynopsis>
  24. </refsynopsisdiv>
  25. <refsect1>
  26. <title>Arguments</title>
  27. <variablelist>
  28. <varlistentry>
  29. <term><parameter>fd</parameter></term>
  30. <listitem>
  31. <para>&fd;</para>
  32. </listitem>
  33. </varlistentry>
  34. <varlistentry>
  35. <term><parameter>request</parameter></term>
  36. <listitem>
  37. <para>VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS,
  38. VIDIOC_TRY_EXT_CTRLS</para>
  39. </listitem>
  40. </varlistentry>
  41. <varlistentry>
  42. <term><parameter>argp</parameter></term>
  43. <listitem>
  44. <para></para>
  45. </listitem>
  46. </varlistentry>
  47. </variablelist>
  48. </refsect1>
  49. <refsect1>
  50. <title>Description</title>
  51. <para>These ioctls allow the caller to get or set multiple
  52. controls atomically. Control IDs are grouped into control classes (see
  53. <xref linkend="ctrl-class" />) and all controls in the control array
  54. must belong to the same control class.</para>
  55. <para>Applications must always fill in the
  56. <structfield>count</structfield>,
  57. <structfield>ctrl_class</structfield>,
  58. <structfield>controls</structfield> and
  59. <structfield>reserved</structfield> fields of &v4l2-ext-controls;, and
  60. initialize the &v4l2-ext-control; array pointed to by the
  61. <structfield>controls</structfield> fields.</para>
  62. <para>To get the current value of a set of controls applications
  63. initialize the <structfield>id</structfield>,
  64. <structfield>size</structfield> and <structfield>reserved2</structfield> fields
  65. of each &v4l2-ext-control; and call the
  66. <constant>VIDIOC_G_EXT_CTRLS</constant> ioctl. String controls controls
  67. must also set the <structfield>string</structfield> field.</para>
  68. <para>If the <structfield>size</structfield> is too small to
  69. receive the control result (only relevant for pointer-type controls
  70. like strings), then the driver will set <structfield>size</structfield>
  71. to a valid value and return an &ENOSPC;. You should re-allocate the
  72. string memory to this new size and try again. It is possible that the
  73. same issue occurs again if the string has grown in the meantime. It is
  74. recommended to call &VIDIOC-QUERYCTRL; first and use
  75. <structfield>maximum</structfield>+1 as the new <structfield>size</structfield>
  76. value. It is guaranteed that that is sufficient memory.
  77. </para>
  78. <para>To change the value of a set of controls applications
  79. initialize the <structfield>id</structfield>, <structfield>size</structfield>,
  80. <structfield>reserved2</structfield> and
  81. <structfield>value/string</structfield> fields of each &v4l2-ext-control; and
  82. call the <constant>VIDIOC_S_EXT_CTRLS</constant> ioctl. The controls
  83. will only be set if <emphasis>all</emphasis> control values are
  84. valid.</para>
  85. <para>To check if a set of controls have correct values applications
  86. initialize the <structfield>id</structfield>, <structfield>size</structfield>,
  87. <structfield>reserved2</structfield> and
  88. <structfield>value/string</structfield> fields of each &v4l2-ext-control; and
  89. call the <constant>VIDIOC_TRY_EXT_CTRLS</constant> ioctl. It is up to
  90. the driver whether wrong values are automatically adjusted to a valid
  91. value or if an error is returned.</para>
  92. <para>When the <structfield>id</structfield> or
  93. <structfield>ctrl_class</structfield> is invalid drivers return an
  94. &EINVAL;. When the value is out of bounds drivers can choose to take
  95. the closest valid value or return an &ERANGE;, whatever seems more
  96. appropriate. In the first case the new value is set in
  97. &v4l2-ext-control;.</para>
  98. <para>The driver will only set/get these controls if all control
  99. values are correct. This prevents the situation where only some of the
  100. controls were set/get. Only low-level errors (&eg; a failed i2c
  101. command) can still cause this situation.</para>
  102. <table pgwide="1" frame="none" id="v4l2-ext-control">
  103. <title>struct <structname>v4l2_ext_control</structname></title>
  104. <tgroup cols="4">
  105. &cs-ustr;
  106. <tbody valign="top">
  107. <row>
  108. <entry>__u32</entry>
  109. <entry><structfield>id</structfield></entry>
  110. <entry></entry>
  111. <entry>Identifies the control, set by the
  112. application.</entry>
  113. </row>
  114. <row>
  115. <entry>__u32</entry>
  116. <entry><structfield>size</structfield></entry>
  117. <entry></entry>
  118. <entry>The total size in bytes of the payload of this
  119. control. This is normally 0, but for pointer controls this should be
  120. set to the size of the memory containing the payload, or that will
  121. receive the payload. If <constant>VIDIOC_G_EXT_CTRLS</constant> finds
  122. that this value is less than is required to store
  123. the payload result, then it is set to a value large enough to store the
  124. payload result and ENOSPC is returned. Note that for string controls
  125. this <structfield>size</structfield> field should not be confused with the length of the string.
  126. This field refers to the size of the memory that contains the string.
  127. The actual <emphasis>length</emphasis> of the string may well be much smaller.
  128. </entry>
  129. </row>
  130. <row>
  131. <entry>__u32</entry>
  132. <entry><structfield>reserved2</structfield>[1]</entry>
  133. <entry></entry>
  134. <entry>Reserved for future extensions. Drivers and
  135. applications must set the array to zero.</entry>
  136. </row>
  137. <row>
  138. <entry>union</entry>
  139. <entry>(anonymous)</entry>
  140. </row>
  141. <row>
  142. <entry></entry>
  143. <entry>__s32</entry>
  144. <entry><structfield>value</structfield></entry>
  145. <entry>New value or current value.</entry>
  146. </row>
  147. <row>
  148. <entry></entry>
  149. <entry>__s64</entry>
  150. <entry><structfield>value64</structfield></entry>
  151. <entry>New value or current value.</entry>
  152. </row>
  153. <row>
  154. <entry></entry>
  155. <entry>char *</entry>
  156. <entry><structfield>string</structfield></entry>
  157. <entry>A pointer to a string.</entry>
  158. </row>
  159. </tbody>
  160. </tgroup>
  161. </table>
  162. <table pgwide="1" frame="none" id="v4l2-ext-controls">
  163. <title>struct <structname>v4l2_ext_controls</structname></title>
  164. <tgroup cols="3">
  165. &cs-str;
  166. <tbody valign="top">
  167. <row>
  168. <entry>__u32</entry>
  169. <entry><structfield>ctrl_class</structfield></entry>
  170. <entry>The control class to which all controls belong, see
  171. <xref linkend="ctrl-class" />.</entry>
  172. </row>
  173. <row>
  174. <entry>__u32</entry>
  175. <entry><structfield>count</structfield></entry>
  176. <entry>The number of controls in the controls array. May
  177. also be zero.</entry>
  178. </row>
  179. <row>
  180. <entry>__u32</entry>
  181. <entry><structfield>error_idx</structfield></entry>
  182. <entry>Set by the driver in case of an error. It is the
  183. index of the control causing the error or equal to 'count' when the
  184. error is not associated with a particular control. Undefined when the
  185. ioctl returns 0 (success).</entry>
  186. </row>
  187. <row>
  188. <entry>__u32</entry>
  189. <entry><structfield>reserved</structfield>[2]</entry>
  190. <entry>Reserved for future extensions. Drivers and
  191. applications must set the array to zero.</entry>
  192. </row>
  193. <row>
  194. <entry>&v4l2-ext-control; *</entry>
  195. <entry><structfield>controls</structfield></entry>
  196. <entry>Pointer to an array of
  197. <structfield>count</structfield> v4l2_ext_control structures. Ignored
  198. if <structfield>count</structfield> equals zero.</entry>
  199. </row>
  200. </tbody>
  201. </tgroup>
  202. </table>
  203. <table pgwide="1" frame="none" id="ctrl-class">
  204. <title>Control classes</title>
  205. <tgroup cols="3">
  206. &cs-def;
  207. <tbody valign="top">
  208. <row>
  209. <entry><constant>V4L2_CTRL_CLASS_USER</constant></entry>
  210. <entry>0x980000</entry>
  211. <entry>The class containing user controls. These controls
  212. are described in <xref linkend="control" />. All controls that can be set
  213. using the &VIDIOC-S-CTRL; and &VIDIOC-G-CTRL; ioctl belong to this
  214. class.</entry>
  215. </row>
  216. <row>
  217. <entry><constant>V4L2_CTRL_CLASS_MPEG</constant></entry>
  218. <entry>0x990000</entry>
  219. <entry>The class containing MPEG compression controls.
  220. These controls are described in <xref
  221. linkend="mpeg-controls" />.</entry>
  222. </row>
  223. <row>
  224. <entry><constant>V4L2_CTRL_CLASS_CAMERA</constant></entry>
  225. <entry>0x9a0000</entry>
  226. <entry>The class containing camera controls.
  227. These controls are described in <xref
  228. linkend="camera-controls" />.</entry>
  229. </row>
  230. <row>
  231. <entry><constant>V4L2_CTRL_CLASS_FM_TX</constant></entry>
  232. <entry>0x9b0000</entry>
  233. <entry>The class containing FM Transmitter (FM TX) controls.
  234. These controls are described in <xref
  235. linkend="fm-tx-controls" />.</entry>
  236. </row>
  237. </tbody>
  238. </tgroup>
  239. </table>
  240. </refsect1>
  241. <refsect1>
  242. &return-value;
  243. <variablelist>
  244. <varlistentry>
  245. <term><errorcode>EINVAL</errorcode></term>
  246. <listitem>
  247. <para>The &v4l2-ext-control; <structfield>id</structfield>
  248. is invalid or the &v4l2-ext-controls;
  249. <structfield>ctrl_class</structfield> is invalid. This error code is
  250. also returned by the <constant>VIDIOC_S_EXT_CTRLS</constant> and
  251. <constant>VIDIOC_TRY_EXT_CTRLS</constant> ioctls if two or more
  252. control values are in conflict.</para>
  253. </listitem>
  254. </varlistentry>
  255. <varlistentry>
  256. <term><errorcode>ERANGE</errorcode></term>
  257. <listitem>
  258. <para>The &v4l2-ext-control; <structfield>value</structfield>
  259. is out of bounds.</para>
  260. </listitem>
  261. </varlistentry>
  262. <varlistentry>
  263. <term><errorcode>EBUSY</errorcode></term>
  264. <listitem>
  265. <para>The control is temporarily not changeable, possibly
  266. because another applications took over control of the device function
  267. this control belongs to.</para>
  268. </listitem>
  269. </varlistentry>
  270. <varlistentry>
  271. <term><errorcode>ENOSPC</errorcode></term>
  272. <listitem>
  273. <para>The space reserved for the control's payload is insufficient.
  274. The field <structfield>size</structfield> is set to a value that is enough
  275. to store the payload and this error code is returned.</para>
  276. </listitem>
  277. </varlistentry>
  278. </variablelist>
  279. </refsect1>
  280. </refentry>
  281. <!--
  282. Local Variables:
  283. mode: sgml
  284. sgml-parent-document: "v4l2.sgml"
  285. indent-tabs-mode: nil
  286. End:
  287. -->