18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_G_EXT_CTRLS:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci******************************************************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, VIDIOC_TRY_EXT_CTRLS
88c2ecf20Sopenharmony_ci******************************************************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_G_EXT_CTRLS - VIDIOC_S_EXT_CTRLS - VIDIOC_TRY_EXT_CTRLS - Get or set the value of several controls, try control values
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_G_EXT_CTRLS
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_EXT_CTRLS, struct v4l2_ext_controls *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_S_EXT_CTRLS
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_EXT_CTRLS, struct v4l2_ext_controls *argp)``
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_TRY_EXT_CTRLS
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_TRY_EXT_CTRLS, struct v4l2_ext_controls *argp)``
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciArguments
318c2ecf20Sopenharmony_ci=========
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci``fd``
348c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci``argp``
378c2ecf20Sopenharmony_ci    Pointer to struct :c:type:`v4l2_ext_controls`.
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciDescription
408c2ecf20Sopenharmony_ci===========
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciThese ioctls allow the caller to get or set multiple controls
438c2ecf20Sopenharmony_ciatomically. Control IDs are grouped into control classes (see
448c2ecf20Sopenharmony_ci:ref:`ctrl-class`) and all controls in the control array must belong
458c2ecf20Sopenharmony_cito the same control class.
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciApplications must always fill in the ``count``, ``which``, ``controls``
488c2ecf20Sopenharmony_ciand ``reserved`` fields of struct
498c2ecf20Sopenharmony_ci:c:type:`v4l2_ext_controls`, and initialize the
508c2ecf20Sopenharmony_cistruct :c:type:`v4l2_ext_control` array pointed to
518c2ecf20Sopenharmony_ciby the ``controls`` fields.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciTo get the current value of a set of controls applications initialize
548c2ecf20Sopenharmony_cithe ``id``, ``size`` and ``reserved2`` fields of each struct
558c2ecf20Sopenharmony_ci:c:type:`v4l2_ext_control` and call the
568c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. String controls controls must also set the
578c2ecf20Sopenharmony_ci``string`` field. Controls of compound types
588c2ecf20Sopenharmony_ci(``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set) must set the ``ptr`` field.
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciIf the ``size`` is too small to receive the control result (only
618c2ecf20Sopenharmony_cirelevant for pointer-type controls like strings), then the driver will
628c2ecf20Sopenharmony_ciset ``size`` to a valid value and return an ``ENOSPC`` error code. You
638c2ecf20Sopenharmony_cishould re-allocate the memory to this new size and try again. For the
648c2ecf20Sopenharmony_cistring type it is possible that the same issue occurs again if the
658c2ecf20Sopenharmony_cistring has grown in the meantime. It is recommended to call
668c2ecf20Sopenharmony_ci:ref:`VIDIOC_QUERYCTRL` first and use
678c2ecf20Sopenharmony_ci``maximum``\ +1 as the new ``size`` value. It is guaranteed that that is
688c2ecf20Sopenharmony_cisufficient memory.
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ciN-dimensional arrays are set and retrieved row-by-row. You cannot set a
718c2ecf20Sopenharmony_cipartial array, all elements have to be set or retrieved. The total size
728c2ecf20Sopenharmony_ciis calculated as ``elems`` * ``elem_size``. These values can be obtained
738c2ecf20Sopenharmony_ciby calling :ref:`VIDIOC_QUERY_EXT_CTRL <VIDIOC_QUERYCTRL>`.
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciTo change the value of a set of controls applications initialize the
768c2ecf20Sopenharmony_ci``id``, ``size``, ``reserved2`` and ``value/value64/string/ptr`` fields
778c2ecf20Sopenharmony_ciof each struct :c:type:`v4l2_ext_control` and call
788c2ecf20Sopenharmony_cithe :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. The controls will only be set if *all*
798c2ecf20Sopenharmony_cicontrol values are valid.
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ciTo check if a set of controls have correct values applications
828c2ecf20Sopenharmony_ciinitialize the ``id``, ``size``, ``reserved2`` and
838c2ecf20Sopenharmony_ci``value/value64/string/ptr`` fields of each struct
848c2ecf20Sopenharmony_ci:c:type:`v4l2_ext_control` and call the
858c2ecf20Sopenharmony_ci:ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. It is up to the driver whether wrong
868c2ecf20Sopenharmony_civalues are automatically adjusted to a valid value or if an error is
878c2ecf20Sopenharmony_cireturned.
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciWhen the ``id`` or ``which`` is invalid drivers return an ``EINVAL`` error
908c2ecf20Sopenharmony_cicode. When the value is out of bounds drivers can choose to take the
918c2ecf20Sopenharmony_ciclosest valid value or return an ``ERANGE`` error code, whatever seems more
928c2ecf20Sopenharmony_ciappropriate. In the first case the new value is set in struct
938c2ecf20Sopenharmony_ci:c:type:`v4l2_ext_control`. If the new control value
948c2ecf20Sopenharmony_ciis inappropriate (e.g. the given menu index is not supported by the menu
958c2ecf20Sopenharmony_cicontrol), then this will also result in an ``EINVAL`` error code error.
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ciIf ``request_fd`` is set to a not-yet-queued :ref:`request <media-request-api>`
988c2ecf20Sopenharmony_cifile descriptor and ``which`` is set to ``V4L2_CTRL_WHICH_REQUEST_VAL``,
998c2ecf20Sopenharmony_cithen the controls are not applied immediately when calling
1008c2ecf20Sopenharmony_ci:ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`, but instead are applied by
1018c2ecf20Sopenharmony_cithe driver for the buffer associated with the same request.
1028c2ecf20Sopenharmony_ciIf the device does not support requests, then ``EACCES`` will be returned.
1038c2ecf20Sopenharmony_ciIf requests are supported but an invalid request file descriptor is given,
1048c2ecf20Sopenharmony_cithen ``EINVAL`` will be returned.
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ciAn attempt to call :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` for a
1078c2ecf20Sopenharmony_cirequest that has already been queued will result in an ``EBUSY`` error.
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ciIf ``request_fd`` is specified and ``which`` is set to
1108c2ecf20Sopenharmony_ci``V4L2_CTRL_WHICH_REQUEST_VAL`` during a call to
1118c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`, then it will return the
1128c2ecf20Sopenharmony_civalues of the controls at the time of request completion.
1138c2ecf20Sopenharmony_ciIf the request is not yet completed, then this will result in an
1148c2ecf20Sopenharmony_ci``EACCES`` error.
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ciThe driver will only set/get these controls if all control values are
1178c2ecf20Sopenharmony_cicorrect. This prevents the situation where only some of the controls
1188c2ecf20Sopenharmony_ciwere set/get. Only low-level errors (e. g. a failed i2c command) can
1198c2ecf20Sopenharmony_cistill cause this situation.
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{1.5cm}|p{11.8cm}|
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci.. c:type:: v4l2_ext_control
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci.. cssclass: longtable
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_ext_control
1288c2ecf20Sopenharmony_ci    :header-rows:  0
1298c2ecf20Sopenharmony_ci    :stub-columns: 0
1308c2ecf20Sopenharmony_ci    :widths:       1 1 2
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci    * - __u32
1338c2ecf20Sopenharmony_ci      - ``id``
1348c2ecf20Sopenharmony_ci      - Identifies the control, set by the application.
1358c2ecf20Sopenharmony_ci    * - __u32
1368c2ecf20Sopenharmony_ci      - ``size``
1378c2ecf20Sopenharmony_ci      - The total size in bytes of the payload of this control. This is
1388c2ecf20Sopenharmony_ci	normally 0, but for pointer controls this should be set to the
1398c2ecf20Sopenharmony_ci	size of the memory containing the payload, or that will receive
1408c2ecf20Sopenharmony_ci	the payload. If :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` finds that this value is
1418c2ecf20Sopenharmony_ci	less than is required to store the payload result, then it is set
1428c2ecf20Sopenharmony_ci	to a value large enough to store the payload result and ``ENOSPC`` is
1438c2ecf20Sopenharmony_ci	returned.
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci	.. note::
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci	   For string controls, this ``size`` field should
1488c2ecf20Sopenharmony_ci	   not be confused with the length of the string. This field refers
1498c2ecf20Sopenharmony_ci	   to the size of the memory that contains the string. The actual
1508c2ecf20Sopenharmony_ci	   *length* of the string may well be much smaller.
1518c2ecf20Sopenharmony_ci    * - __u32
1528c2ecf20Sopenharmony_ci      - ``reserved2``\ [1]
1538c2ecf20Sopenharmony_ci      - Reserved for future extensions. Drivers and applications must set
1548c2ecf20Sopenharmony_ci	the array to zero.
1558c2ecf20Sopenharmony_ci    * - union {
1568c2ecf20Sopenharmony_ci      - (anonymous)
1578c2ecf20Sopenharmony_ci    * - __s32
1588c2ecf20Sopenharmony_ci      - ``value``
1598c2ecf20Sopenharmony_ci      - New value or current value. Valid if this control is not of type
1608c2ecf20Sopenharmony_ci	``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is
1618c2ecf20Sopenharmony_ci	not set.
1628c2ecf20Sopenharmony_ci    * - __s64
1638c2ecf20Sopenharmony_ci      - ``value64``
1648c2ecf20Sopenharmony_ci      - New value or current value. Valid if this control is of type
1658c2ecf20Sopenharmony_ci	``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is
1668c2ecf20Sopenharmony_ci	not set.
1678c2ecf20Sopenharmony_ci    * - char *
1688c2ecf20Sopenharmony_ci      - ``string``
1698c2ecf20Sopenharmony_ci      - A pointer to a string. Valid if this control is of type
1708c2ecf20Sopenharmony_ci	``V4L2_CTRL_TYPE_STRING``.
1718c2ecf20Sopenharmony_ci    * - __u8 *
1728c2ecf20Sopenharmony_ci      - ``p_u8``
1738c2ecf20Sopenharmony_ci      - A pointer to a matrix control of unsigned 8-bit values. Valid if
1748c2ecf20Sopenharmony_ci	this control is of type ``V4L2_CTRL_TYPE_U8``.
1758c2ecf20Sopenharmony_ci    * - __u16 *
1768c2ecf20Sopenharmony_ci      - ``p_u16``
1778c2ecf20Sopenharmony_ci      - A pointer to a matrix control of unsigned 16-bit values. Valid if
1788c2ecf20Sopenharmony_ci	this control is of type ``V4L2_CTRL_TYPE_U16``.
1798c2ecf20Sopenharmony_ci    * - __u32 *
1808c2ecf20Sopenharmony_ci      - ``p_u32``
1818c2ecf20Sopenharmony_ci      - A pointer to a matrix control of unsigned 32-bit values. Valid if
1828c2ecf20Sopenharmony_ci	this control is of type ``V4L2_CTRL_TYPE_U32``.
1838c2ecf20Sopenharmony_ci    * - :c:type:`v4l2_area` *
1848c2ecf20Sopenharmony_ci      - ``p_area``
1858c2ecf20Sopenharmony_ci      - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is
1868c2ecf20Sopenharmony_ci        of type ``V4L2_CTRL_TYPE_AREA``.
1878c2ecf20Sopenharmony_ci    * - void *
1888c2ecf20Sopenharmony_ci      - ``ptr``
1898c2ecf20Sopenharmony_ci      - A pointer to a compound type which can be an N-dimensional array
1908c2ecf20Sopenharmony_ci	and/or a compound type (the control's type is >=
1918c2ecf20Sopenharmony_ci	``V4L2_CTRL_COMPOUND_TYPES``). Valid if
1928c2ecf20Sopenharmony_ci	``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set for this control.
1938c2ecf20Sopenharmony_ci    * - }
1948c2ecf20Sopenharmony_ci      -
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.0cm}|p{2.2cm}|p{2.1cm}|p{8.2cm}|
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci.. c:type:: v4l2_ext_controls
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci.. cssclass:: longtable
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_ext_controls
2038c2ecf20Sopenharmony_ci    :header-rows:  0
2048c2ecf20Sopenharmony_ci    :stub-columns: 0
2058c2ecf20Sopenharmony_ci    :widths:       1 1 2
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci    * - union {
2088c2ecf20Sopenharmony_ci      - (anonymous)
2098c2ecf20Sopenharmony_ci    * - __u32
2108c2ecf20Sopenharmony_ci      - ``ctrl_class``
2118c2ecf20Sopenharmony_ci      - The control class to which all controls belong, see
2128c2ecf20Sopenharmony_ci	:ref:`ctrl-class`. Drivers that use a kernel framework for
2138c2ecf20Sopenharmony_ci	handling controls will also accept a value of 0 here, meaning that
2148c2ecf20Sopenharmony_ci	the controls can belong to any control class. Whether drivers
2158c2ecf20Sopenharmony_ci	support this can be tested by setting ``ctrl_class`` to 0 and
2168c2ecf20Sopenharmony_ci	calling :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` with a ``count`` of 0. If that
2178c2ecf20Sopenharmony_ci	succeeds, then the driver supports this feature.
2188c2ecf20Sopenharmony_ci    * - __u32
2198c2ecf20Sopenharmony_ci      - ``which``
2208c2ecf20Sopenharmony_ci      - Which value of the control to get/set/try.
2218c2ecf20Sopenharmony_ci	``V4L2_CTRL_WHICH_CUR_VAL`` will return the current value of the
2228c2ecf20Sopenharmony_ci	control, ``V4L2_CTRL_WHICH_DEF_VAL`` will return the default
2238c2ecf20Sopenharmony_ci	value of the control and ``V4L2_CTRL_WHICH_REQUEST_VAL`` indicates that
2248c2ecf20Sopenharmony_ci	these controls have to be retrieved from a request or tried/set for
2258c2ecf20Sopenharmony_ci	a request. In the latter case the ``request_fd`` field contains the
2268c2ecf20Sopenharmony_ci	file descriptor of the request that should be used. If the device
2278c2ecf20Sopenharmony_ci	does not support requests, then ``EACCES`` will be returned.
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci	.. note::
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci	   When using ``V4L2_CTRL_WHICH_DEF_VAL`` be aware that you can only
2328c2ecf20Sopenharmony_ci	   get the default value of the control, you cannot set or try it.
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci	For backwards compatibility you can also use a control class here
2358c2ecf20Sopenharmony_ci	(see :ref:`ctrl-class`). In that case all controls have to
2368c2ecf20Sopenharmony_ci	belong to that control class. This usage is deprecated, instead
2378c2ecf20Sopenharmony_ci	just use ``V4L2_CTRL_WHICH_CUR_VAL``. There are some very old
2388c2ecf20Sopenharmony_ci	drivers that do not yet support ``V4L2_CTRL_WHICH_CUR_VAL`` and
2398c2ecf20Sopenharmony_ci	that require a control class here. You can test for such drivers
2408c2ecf20Sopenharmony_ci	by setting ctrl_class to ``V4L2_CTRL_WHICH_CUR_VAL`` and calling
2418c2ecf20Sopenharmony_ci	VIDIOC_TRY_EXT_CTRLS with a count of 0. If that fails, then the
2428c2ecf20Sopenharmony_ci	driver does not support ``V4L2_CTRL_WHICH_CUR_VAL``.
2438c2ecf20Sopenharmony_ci    * - }
2448c2ecf20Sopenharmony_ci      -
2458c2ecf20Sopenharmony_ci    * - __u32
2468c2ecf20Sopenharmony_ci      - ``count``
2478c2ecf20Sopenharmony_ci      - The number of controls in the controls array. May also be zero.
2488c2ecf20Sopenharmony_ci    * - __u32
2498c2ecf20Sopenharmony_ci      - ``error_idx``
2508c2ecf20Sopenharmony_ci      - Set by the driver in case of an error. If the error is associated
2518c2ecf20Sopenharmony_ci	with a particular control, then ``error_idx`` is set to the index
2528c2ecf20Sopenharmony_ci	of that control. If the error is not related to a specific
2538c2ecf20Sopenharmony_ci	control, or the validation step failed (see below), then
2548c2ecf20Sopenharmony_ci	``error_idx`` is set to ``count``. The value is undefined if the
2558c2ecf20Sopenharmony_ci	ioctl returned 0 (success).
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	Before controls are read from/written to hardware a validation
2588c2ecf20Sopenharmony_ci	step takes place: this checks if all controls in the list are
2598c2ecf20Sopenharmony_ci	valid controls, if no attempt is made to write to a read-only
2608c2ecf20Sopenharmony_ci	control or read from a write-only control, and any other up-front
2618c2ecf20Sopenharmony_ci	checks that can be done without accessing the hardware. The exact
2628c2ecf20Sopenharmony_ci	validations done during this step are driver dependent since some
2638c2ecf20Sopenharmony_ci	checks might require hardware access for some devices, thus making
2648c2ecf20Sopenharmony_ci	it impossible to do those checks up-front. However, drivers should
2658c2ecf20Sopenharmony_ci	make a best-effort to do as many up-front checks as possible.
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci	This check is done to avoid leaving the hardware in an
2688c2ecf20Sopenharmony_ci	inconsistent state due to easy-to-avoid problems. But it leads to
2698c2ecf20Sopenharmony_ci	another problem: the application needs to know whether an error
2708c2ecf20Sopenharmony_ci	came from the validation step (meaning that the hardware was not
2718c2ecf20Sopenharmony_ci	touched) or from an error during the actual reading from/writing
2728c2ecf20Sopenharmony_ci	to hardware.
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci	The, in hindsight quite poor, solution for that is to set
2758c2ecf20Sopenharmony_ci	``error_idx`` to ``count`` if the validation failed. This has the
2768c2ecf20Sopenharmony_ci	unfortunate side-effect that it is not possible to see which
2778c2ecf20Sopenharmony_ci	control failed the validation. If the validation was successful
2788c2ecf20Sopenharmony_ci	and the error happened while accessing the hardware, then
2798c2ecf20Sopenharmony_ci	``error_idx`` is less than ``count`` and only the controls up to
2808c2ecf20Sopenharmony_ci	``error_idx-1`` were read or written correctly, and the state of
2818c2ecf20Sopenharmony_ci	the remaining controls is undefined.
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci	Since :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` does not access hardware there is
2848c2ecf20Sopenharmony_ci	also no need to handle the validation step in this special way, so
2858c2ecf20Sopenharmony_ci	``error_idx`` will just be set to the control that failed the
2868c2ecf20Sopenharmony_ci	validation step instead of to ``count``. This means that if
2878c2ecf20Sopenharmony_ci	:ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` fails with ``error_idx`` set to ``count``,
2888c2ecf20Sopenharmony_ci	then you can call :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` to try to discover the
2898c2ecf20Sopenharmony_ci	actual control that failed the validation step. Unfortunately,
2908c2ecf20Sopenharmony_ci	there is no ``TRY`` equivalent for :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`.
2918c2ecf20Sopenharmony_ci    * - __s32
2928c2ecf20Sopenharmony_ci      - ``request_fd``
2938c2ecf20Sopenharmony_ci      - File descriptor of the request to be used by this operation. Only
2948c2ecf20Sopenharmony_ci	valid if ``which`` is set to ``V4L2_CTRL_WHICH_REQUEST_VAL``.
2958c2ecf20Sopenharmony_ci	If the device does not support requests, then ``EACCES`` will be returned.
2968c2ecf20Sopenharmony_ci	If requests are supported but an invalid request file descriptor is
2978c2ecf20Sopenharmony_ci	given, then ``EINVAL`` will be returned.
2988c2ecf20Sopenharmony_ci    * - __u32
2998c2ecf20Sopenharmony_ci      - ``reserved``\ [1]
3008c2ecf20Sopenharmony_ci      - Reserved for future extensions.
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci	Drivers and applications must set the array to zero.
3038c2ecf20Sopenharmony_ci    * - struct :c:type:`v4l2_ext_control` *
3048c2ecf20Sopenharmony_ci      - ``controls``
3058c2ecf20Sopenharmony_ci      - Pointer to an array of ``count`` v4l2_ext_control structures.
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci	Ignored if ``count`` equals zero.
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci.. _ctrl-class:
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci.. flat-table:: Control classes
3148c2ecf20Sopenharmony_ci    :header-rows:  0
3158c2ecf20Sopenharmony_ci    :stub-columns: 0
3168c2ecf20Sopenharmony_ci    :widths:       3 1 4
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_USER``
3198c2ecf20Sopenharmony_ci      - 0x980000
3208c2ecf20Sopenharmony_ci      - The class containing user controls. These controls are described
3218c2ecf20Sopenharmony_ci	in :ref:`control`. All controls that can be set using the
3228c2ecf20Sopenharmony_ci	:ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` and
3238c2ecf20Sopenharmony_ci	:ref:`VIDIOC_G_CTRL <VIDIOC_G_CTRL>` ioctl belong to this
3248c2ecf20Sopenharmony_ci	class.
3258c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_MPEG``
3268c2ecf20Sopenharmony_ci      - 0x990000
3278c2ecf20Sopenharmony_ci      - The class containing MPEG compression controls. These controls are
3288c2ecf20Sopenharmony_ci	described in :ref:`mpeg-controls`.
3298c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_CAMERA``
3308c2ecf20Sopenharmony_ci      - 0x9a0000
3318c2ecf20Sopenharmony_ci      - The class containing camera controls. These controls are described
3328c2ecf20Sopenharmony_ci	in :ref:`camera-controls`.
3338c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_FM_TX``
3348c2ecf20Sopenharmony_ci      - 0x9b0000
3358c2ecf20Sopenharmony_ci      - The class containing FM Transmitter (FM TX) controls. These
3368c2ecf20Sopenharmony_ci	controls are described in :ref:`fm-tx-controls`.
3378c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_FLASH``
3388c2ecf20Sopenharmony_ci      - 0x9c0000
3398c2ecf20Sopenharmony_ci      - The class containing flash device controls. These controls are
3408c2ecf20Sopenharmony_ci	described in :ref:`flash-controls`.
3418c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_JPEG``
3428c2ecf20Sopenharmony_ci      - 0x9d0000
3438c2ecf20Sopenharmony_ci      - The class containing JPEG compression controls. These controls are
3448c2ecf20Sopenharmony_ci	described in :ref:`jpeg-controls`.
3458c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_IMAGE_SOURCE``
3468c2ecf20Sopenharmony_ci      - 0x9e0000
3478c2ecf20Sopenharmony_ci      - The class containing image source controls. These controls are
3488c2ecf20Sopenharmony_ci	described in :ref:`image-source-controls`.
3498c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_IMAGE_PROC``
3508c2ecf20Sopenharmony_ci      - 0x9f0000
3518c2ecf20Sopenharmony_ci      - The class containing image processing controls. These controls are
3528c2ecf20Sopenharmony_ci	described in :ref:`image-process-controls`.
3538c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_FM_RX``
3548c2ecf20Sopenharmony_ci      - 0xa10000
3558c2ecf20Sopenharmony_ci      - The class containing FM Receiver (FM RX) controls. These controls
3568c2ecf20Sopenharmony_ci	are described in :ref:`fm-rx-controls`.
3578c2ecf20Sopenharmony_ci    * - ``V4L2_CTRL_CLASS_RF_TUNER``
3588c2ecf20Sopenharmony_ci      - 0xa20000
3598c2ecf20Sopenharmony_ci      - The class containing RF tuner controls. These controls are
3608c2ecf20Sopenharmony_ci	described in :ref:`rf-tuner-controls`.
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ciReturn Value
3638c2ecf20Sopenharmony_ci============
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
3668c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
3678c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ciEINVAL
3708c2ecf20Sopenharmony_ci    The struct :c:type:`v4l2_ext_control` ``id`` is
3718c2ecf20Sopenharmony_ci    invalid, or the struct :c:type:`v4l2_ext_controls`
3728c2ecf20Sopenharmony_ci    ``which`` is invalid, or the struct
3738c2ecf20Sopenharmony_ci    :c:type:`v4l2_ext_control` ``value`` was
3748c2ecf20Sopenharmony_ci    inappropriate (e.g. the given menu index is not supported by the
3758c2ecf20Sopenharmony_ci    driver), or the ``which`` field was set to ``V4L2_CTRL_WHICH_REQUEST_VAL``
3768c2ecf20Sopenharmony_ci    but the given ``request_fd`` was invalid or ``V4L2_CTRL_WHICH_REQUEST_VAL``
3778c2ecf20Sopenharmony_ci    is not supported by the kernel.
3788c2ecf20Sopenharmony_ci    This error code is also returned by the
3798c2ecf20Sopenharmony_ci    :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` and :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctls if two or
3808c2ecf20Sopenharmony_ci    more control values are in conflict.
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ciERANGE
3838c2ecf20Sopenharmony_ci    The struct :c:type:`v4l2_ext_control` ``value``
3848c2ecf20Sopenharmony_ci    is out of bounds.
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ciEBUSY
3878c2ecf20Sopenharmony_ci    The control is temporarily not changeable, possibly because another
3888c2ecf20Sopenharmony_ci    applications took over control of the device function this control
3898c2ecf20Sopenharmony_ci    belongs to, or (if the ``which`` field was set to
3908c2ecf20Sopenharmony_ci    ``V4L2_CTRL_WHICH_REQUEST_VAL``) the request was queued but not yet
3918c2ecf20Sopenharmony_ci    completed.
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ciENOSPC
3948c2ecf20Sopenharmony_ci    The space reserved for the control's payload is insufficient. The
3958c2ecf20Sopenharmony_ci    field ``size`` is set to a value that is enough to store the payload
3968c2ecf20Sopenharmony_ci    and this error code is returned.
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ciEACCES
3998c2ecf20Sopenharmony_ci    Attempt to try or set a read-only control, or to get a write-only
4008c2ecf20Sopenharmony_ci    control, or to get a control from a request that has not yet been
4018c2ecf20Sopenharmony_ci    completed.
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci    Or the ``which`` field was set to ``V4L2_CTRL_WHICH_REQUEST_VAL`` but the
4048c2ecf20Sopenharmony_ci    device does not support requests.
405