162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 262306a36Sopenharmony_ci.. c:namespace:: V4L 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci.. _VIDIOC_G_EXT_CTRLS: 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci****************************************************************** 762306a36Sopenharmony_ciioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, VIDIOC_TRY_EXT_CTRLS 862306a36Sopenharmony_ci****************************************************************** 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciName 1162306a36Sopenharmony_ci==== 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciVIDIOC_G_EXT_CTRLS - VIDIOC_S_EXT_CTRLS - VIDIOC_TRY_EXT_CTRLS - Get or set the value of several controls, try control values 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ciSynopsis 1662306a36Sopenharmony_ci======== 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_G_EXT_CTRLS 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_EXT_CTRLS, struct v4l2_ext_controls *argp)`` 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci.. c:macro:: VIDIOC_S_EXT_CTRLS 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_EXT_CTRLS, struct v4l2_ext_controls *argp)`` 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci.. c:macro:: VIDIOC_TRY_EXT_CTRLS 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_TRY_EXT_CTRLS, struct v4l2_ext_controls *argp)`` 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ciArguments 3162306a36Sopenharmony_ci========= 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci``fd`` 3462306a36Sopenharmony_ci File descriptor returned by :c:func:`open()`. 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci``argp`` 3762306a36Sopenharmony_ci Pointer to struct :c:type:`v4l2_ext_controls`. 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ciDescription 4062306a36Sopenharmony_ci=========== 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ciThese ioctls allow the caller to get or set multiple controls 4362306a36Sopenharmony_ciatomically. Control IDs are grouped into control classes (see 4462306a36Sopenharmony_ci:ref:`ctrl-class`) and all controls in the control array must belong 4562306a36Sopenharmony_cito the same control class. 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ciApplications must always fill in the ``count``, ``which``, ``controls`` 4862306a36Sopenharmony_ciand ``reserved`` fields of struct 4962306a36Sopenharmony_ci:c:type:`v4l2_ext_controls`, and initialize the 5062306a36Sopenharmony_cistruct :c:type:`v4l2_ext_control` array pointed to 5162306a36Sopenharmony_ciby the ``controls`` fields. 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ciTo get the current value of a set of controls applications initialize 5462306a36Sopenharmony_cithe ``id``, ``size`` and ``reserved2`` fields of each struct 5562306a36Sopenharmony_ci:c:type:`v4l2_ext_control` and call the 5662306a36Sopenharmony_ci:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. String controls must also set the 5762306a36Sopenharmony_ci``string`` field. Controls of compound types 5862306a36Sopenharmony_ci(``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set) must set the ``ptr`` field. 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ciIf the ``size`` is too small to receive the control result (only 6162306a36Sopenharmony_cirelevant for pointer-type controls like strings), then the driver will 6262306a36Sopenharmony_ciset ``size`` to a valid value and return an ``ENOSPC`` error code. You 6362306a36Sopenharmony_cishould re-allocate the memory to this new size and try again. For the 6462306a36Sopenharmony_cistring type it is possible that the same issue occurs again if the 6562306a36Sopenharmony_cistring has grown in the meantime. It is recommended to call 6662306a36Sopenharmony_ci:ref:`VIDIOC_QUERYCTRL` first and use 6762306a36Sopenharmony_ci``maximum``\ +1 as the new ``size`` value. It is guaranteed that that is 6862306a36Sopenharmony_cisufficient memory. 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ciN-dimensional arrays are set and retrieved row-by-row. You cannot set a 7162306a36Sopenharmony_cipartial array, all elements have to be set or retrieved. The total size 7262306a36Sopenharmony_ciis calculated as ``elems`` * ``elem_size``. These values can be obtained 7362306a36Sopenharmony_ciby calling :ref:`VIDIOC_QUERY_EXT_CTRL <VIDIOC_QUERYCTRL>`. 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ciTo change the value of a set of controls applications initialize the 7662306a36Sopenharmony_ci``id``, ``size``, ``reserved2`` and ``value/value64/string/ptr`` fields 7762306a36Sopenharmony_ciof each struct :c:type:`v4l2_ext_control` and call 7862306a36Sopenharmony_cithe :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. The controls will only be set if *all* 7962306a36Sopenharmony_cicontrol values are valid. 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ciTo check if a set of controls have correct values applications 8262306a36Sopenharmony_ciinitialize the ``id``, ``size``, ``reserved2`` and 8362306a36Sopenharmony_ci``value/value64/string/ptr`` fields of each struct 8462306a36Sopenharmony_ci:c:type:`v4l2_ext_control` and call the 8562306a36Sopenharmony_ci:ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. It is up to the driver whether wrong 8662306a36Sopenharmony_civalues are automatically adjusted to a valid value or if an error is 8762306a36Sopenharmony_cireturned. 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ciWhen the ``id`` or ``which`` is invalid drivers return an ``EINVAL`` error 9062306a36Sopenharmony_cicode. When the value is out of bounds drivers can choose to take the 9162306a36Sopenharmony_ciclosest valid value or return an ``ERANGE`` error code, whatever seems more 9262306a36Sopenharmony_ciappropriate. In the first case the new value is set in struct 9362306a36Sopenharmony_ci:c:type:`v4l2_ext_control`. If the new control value 9462306a36Sopenharmony_ciis inappropriate (e.g. the given menu index is not supported by the menu 9562306a36Sopenharmony_cicontrol), then this will also result in an ``EINVAL`` error code error. 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ciIf ``request_fd`` is set to a not-yet-queued :ref:`request <media-request-api>` 9862306a36Sopenharmony_cifile descriptor and ``which`` is set to ``V4L2_CTRL_WHICH_REQUEST_VAL``, 9962306a36Sopenharmony_cithen the controls are not applied immediately when calling 10062306a36Sopenharmony_ci:ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`, but instead are applied by 10162306a36Sopenharmony_cithe driver for the buffer associated with the same request. 10262306a36Sopenharmony_ciIf the device does not support requests, then ``EACCES`` will be returned. 10362306a36Sopenharmony_ciIf requests are supported but an invalid request file descriptor is given, 10462306a36Sopenharmony_cithen ``EINVAL`` will be returned. 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ciAn attempt to call :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` for a 10762306a36Sopenharmony_cirequest that has already been queued will result in an ``EBUSY`` error. 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ciIf ``request_fd`` is specified and ``which`` is set to 11062306a36Sopenharmony_ci``V4L2_CTRL_WHICH_REQUEST_VAL`` during a call to 11162306a36Sopenharmony_ci:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`, then it will return the 11262306a36Sopenharmony_civalues of the controls at the time of request completion. 11362306a36Sopenharmony_ciIf the request is not yet completed, then this will result in an 11462306a36Sopenharmony_ci``EACCES`` error. 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ciThe driver will only set/get these controls if all control values are 11762306a36Sopenharmony_cicorrect. This prevents the situation where only some of the controls 11862306a36Sopenharmony_ciwere set/get. Only low-level errors (e. g. a failed i2c command) can 11962306a36Sopenharmony_cistill cause this situation. 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci.. tabularcolumns:: |p{6.8cm}|p{4.0cm}|p{6.5cm}| 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci.. c:type:: v4l2_ext_control 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci.. raw:: latex 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci \footnotesize 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci.. cssclass:: longtable 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci.. flat-table:: struct v4l2_ext_control 13262306a36Sopenharmony_ci :header-rows: 0 13362306a36Sopenharmony_ci :stub-columns: 0 13462306a36Sopenharmony_ci :widths: 1 1 2 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci * - __u32 13762306a36Sopenharmony_ci - ``id`` 13862306a36Sopenharmony_ci - Identifies the control, set by the application. 13962306a36Sopenharmony_ci * - __u32 14062306a36Sopenharmony_ci - ``size`` 14162306a36Sopenharmony_ci - The total size in bytes of the payload of this control. 14262306a36Sopenharmony_ci * - :cspan:`2` The ``size`` field is normally 0, but for pointer 14362306a36Sopenharmony_ci controls this should be set to the size of the memory that contains 14462306a36Sopenharmony_ci the payload or that will receive the payload. 14562306a36Sopenharmony_ci If :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` finds that this value 14662306a36Sopenharmony_ci is less than is required to store the payload result, then it is set 14762306a36Sopenharmony_ci to a value large enough to store the payload result and ``ENOSPC`` is 14862306a36Sopenharmony_ci returned. 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci .. note:: 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci For string controls, this ``size`` field should 15362306a36Sopenharmony_ci not be confused with the length of the string. This field refers 15462306a36Sopenharmony_ci to the size of the memory that contains the string. The actual 15562306a36Sopenharmony_ci *length* of the string may well be much smaller. 15662306a36Sopenharmony_ci * - __u32 15762306a36Sopenharmony_ci - ``reserved2``\ [1] 15862306a36Sopenharmony_ci - Reserved for future extensions. Drivers and applications must set 15962306a36Sopenharmony_ci the array to zero. 16062306a36Sopenharmony_ci * - union { 16162306a36Sopenharmony_ci - (anonymous) 16262306a36Sopenharmony_ci * - __s32 16362306a36Sopenharmony_ci - ``value`` 16462306a36Sopenharmony_ci - New value or current value. Valid if this control is not of type 16562306a36Sopenharmony_ci ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is 16662306a36Sopenharmony_ci not set. 16762306a36Sopenharmony_ci * - __s64 16862306a36Sopenharmony_ci - ``value64`` 16962306a36Sopenharmony_ci - New value or current value. Valid if this control is of type 17062306a36Sopenharmony_ci ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is 17162306a36Sopenharmony_ci not set. 17262306a36Sopenharmony_ci * - char * 17362306a36Sopenharmony_ci - ``string`` 17462306a36Sopenharmony_ci - A pointer to a string. Valid if this control is of type 17562306a36Sopenharmony_ci ``V4L2_CTRL_TYPE_STRING``. 17662306a36Sopenharmony_ci * - __u8 * 17762306a36Sopenharmony_ci - ``p_u8`` 17862306a36Sopenharmony_ci - A pointer to a matrix control of unsigned 8-bit values. Valid if 17962306a36Sopenharmony_ci this control is of type ``V4L2_CTRL_TYPE_U8``. 18062306a36Sopenharmony_ci * - __u16 * 18162306a36Sopenharmony_ci - ``p_u16`` 18262306a36Sopenharmony_ci - A pointer to a matrix control of unsigned 16-bit values. Valid if 18362306a36Sopenharmony_ci this control is of type ``V4L2_CTRL_TYPE_U16``. 18462306a36Sopenharmony_ci * - __u32 * 18562306a36Sopenharmony_ci - ``p_u32`` 18662306a36Sopenharmony_ci - A pointer to a matrix control of unsigned 32-bit values. Valid if 18762306a36Sopenharmony_ci this control is of type ``V4L2_CTRL_TYPE_U32``. 18862306a36Sopenharmony_ci * - __s32 * 18962306a36Sopenharmony_ci - ``p_s32`` 19062306a36Sopenharmony_ci - A pointer to a matrix control of signed 32-bit values. Valid if 19162306a36Sopenharmony_ci this control is of type ``V4L2_CTRL_TYPE_INTEGER`` and 19262306a36Sopenharmony_ci ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set. 19362306a36Sopenharmony_ci * - __s64 * 19462306a36Sopenharmony_ci - ``p_s64`` 19562306a36Sopenharmony_ci - A pointer to a matrix control of signed 64-bit values. Valid if 19662306a36Sopenharmony_ci this control is of type ``V4L2_CTRL_TYPE_INTEGER64`` and 19762306a36Sopenharmony_ci ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set. 19862306a36Sopenharmony_ci * - struct :c:type:`v4l2_area` * 19962306a36Sopenharmony_ci - ``p_area`` 20062306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is 20162306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_AREA``. 20262306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_h264_sps` * 20362306a36Sopenharmony_ci - ``p_h264_sps`` 20462306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_h264_sps`. Valid if this control is 20562306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_H264_SPS``. 20662306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_h264_pps` * 20762306a36Sopenharmony_ci - ``p_h264_pps`` 20862306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_h264_pps`. Valid if this control is 20962306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_H264_PPS``. 21062306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_h264_scaling_matrix` * 21162306a36Sopenharmony_ci - ``p_h264_scaling_matrix`` 21262306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_h264_scaling_matrix`. Valid if this control is 21362306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``. 21462306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_h264_pred_weights` * 21562306a36Sopenharmony_ci - ``p_h264_pred_weights`` 21662306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_h264_pred_weights`. Valid if this control is 21762306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_H264_PRED_WEIGHTS``. 21862306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_h264_slice_params` * 21962306a36Sopenharmony_ci - ``p_h264_slice_params`` 22062306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_h264_slice_params`. Valid if this control is 22162306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``. 22262306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_h264_decode_params` * 22362306a36Sopenharmony_ci - ``p_h264_decode_params`` 22462306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_h264_decode_params`. Valid if this control is 22562306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``. 22662306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_fwht_params` * 22762306a36Sopenharmony_ci - ``p_fwht_params`` 22862306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_fwht_params`. Valid if this control is 22962306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_FWHT_PARAMS``. 23062306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_vp8_frame` * 23162306a36Sopenharmony_ci - ``p_vp8_frame`` 23262306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_vp8_frame`. Valid if this control is 23362306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_VP8_FRAME``. 23462306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_mpeg2_sequence` * 23562306a36Sopenharmony_ci - ``p_mpeg2_sequence`` 23662306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_sequence`. Valid if this control is 23762306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_MPEG2_SEQUENCE``. 23862306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_mpeg2_picture` * 23962306a36Sopenharmony_ci - ``p_mpeg2_picture`` 24062306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_picture`. Valid if this control is 24162306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_MPEG2_PICTURE``. 24262306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_mpeg2_quantisation` * 24362306a36Sopenharmony_ci - ``p_mpeg2_quantisation`` 24462306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_quantisation`. Valid if this control is 24562306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_MPEG2_QUANTISATION``. 24662306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_vp9_compressed_hdr` * 24762306a36Sopenharmony_ci - ``p_vp9_compressed_hdr_probs`` 24862306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_vp9_compressed_hdr`. Valid if this 24962306a36Sopenharmony_ci control is of type ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR``. 25062306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_vp9_frame` * 25162306a36Sopenharmony_ci - ``p_vp9_frame`` 25262306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_vp9_frame`. Valid if this 25362306a36Sopenharmony_ci control is of type ``V4L2_CTRL_TYPE_VP9_FRAME``. 25462306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_hdr10_cll_info` * 25562306a36Sopenharmony_ci - ``p_hdr10_cll`` 25662306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_cll_info`. Valid if this control is 25762306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_HDR10_CLL_INFO``. 25862306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_hdr10_mastering_display` * 25962306a36Sopenharmony_ci - ``p_hdr10_mastering`` 26062306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_mastering_display`. Valid if this control is 26162306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY``. 26262306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_hevc_sps` * 26362306a36Sopenharmony_ci - ``p_hevc_sps`` 26462306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_hevc_sps`. Valid if this 26562306a36Sopenharmony_ci control is of type ``V4L2_CTRL_TYPE_HEVC_SPS``. 26662306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_hevc_pps` * 26762306a36Sopenharmony_ci - ``p_hevc_pps`` 26862306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_hevc_pps`. Valid if this 26962306a36Sopenharmony_ci control is of type ``V4L2_CTRL_TYPE_HEVC_PPS``. 27062306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_hevc_slice_params` * 27162306a36Sopenharmony_ci - ``p_hevc_slice_params`` 27262306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_hevc_slice_params`. Valid if this 27362306a36Sopenharmony_ci control is of type ``V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS``. 27462306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_hevc_scaling_matrix` * 27562306a36Sopenharmony_ci - ``p_hevc_scaling_matrix`` 27662306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_hevc_scaling_matrix`. Valid if this 27762306a36Sopenharmony_ci control is of type ``V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX``. 27862306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_hevc_decode_params` * 27962306a36Sopenharmony_ci - ``p_hevc_decode_params`` 28062306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_hevc_decode_params`. Valid if this 28162306a36Sopenharmony_ci control is of type ``V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS``. 28262306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_av1_sequence` * 28362306a36Sopenharmony_ci - ``p_av1_sequence`` 28462306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_av1_sequence`. Valid if this control is 28562306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_AV1_SEQUENCE``. 28662306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_av1_tile_group_entry` * 28762306a36Sopenharmony_ci - ``p_av1_tile_group_entry`` 28862306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_av1_tile_group_entry`. Valid if this control is 28962306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY``. 29062306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_av1_frame` * 29162306a36Sopenharmony_ci - ``p_av1_frame`` 29262306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_av1_frame`. Valid if this control is 29362306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_AV1_FRAME``. 29462306a36Sopenharmony_ci * - struct :c:type:`v4l2_ctrl_av1_film_grain` * 29562306a36Sopenharmony_ci - ``p_av1_film_grain`` 29662306a36Sopenharmony_ci - A pointer to a struct :c:type:`v4l2_ctrl_av1_film_grain`. Valid if this control is 29762306a36Sopenharmony_ci of type ``V4L2_CTRL_TYPE_AV1_FILM_GRAIN``. 29862306a36Sopenharmony_ci * - void * 29962306a36Sopenharmony_ci - ``ptr`` 30062306a36Sopenharmony_ci - A pointer to a compound type which can be an N-dimensional array 30162306a36Sopenharmony_ci and/or a compound type (the control's type is >= 30262306a36Sopenharmony_ci ``V4L2_CTRL_COMPOUND_TYPES``). Valid if 30362306a36Sopenharmony_ci ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set for this control. 30462306a36Sopenharmony_ci * - } 30562306a36Sopenharmony_ci - 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ci.. raw:: latex 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci \normalsize 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ci.. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{10.8cm}| 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci.. c:type:: v4l2_ext_controls 31462306a36Sopenharmony_ci 31562306a36Sopenharmony_ci.. cssclass:: longtable 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ci.. flat-table:: struct v4l2_ext_controls 31862306a36Sopenharmony_ci :header-rows: 0 31962306a36Sopenharmony_ci :stub-columns: 0 32062306a36Sopenharmony_ci :widths: 1 1 2 32162306a36Sopenharmony_ci 32262306a36Sopenharmony_ci * - union { 32362306a36Sopenharmony_ci - (anonymous) 32462306a36Sopenharmony_ci * - __u32 32562306a36Sopenharmony_ci - ``which`` 32662306a36Sopenharmony_ci - Which value of the control to get/set/try. 32762306a36Sopenharmony_ci * - :cspan:`2` ``V4L2_CTRL_WHICH_CUR_VAL`` will return the current value of 32862306a36Sopenharmony_ci the control, ``V4L2_CTRL_WHICH_DEF_VAL`` will return the default 32962306a36Sopenharmony_ci value of the control and ``V4L2_CTRL_WHICH_REQUEST_VAL`` indicates that 33062306a36Sopenharmony_ci these controls have to be retrieved from a request or tried/set for 33162306a36Sopenharmony_ci a request. In the latter case the ``request_fd`` field contains the 33262306a36Sopenharmony_ci file descriptor of the request that should be used. If the device 33362306a36Sopenharmony_ci does not support requests, then ``EACCES`` will be returned. 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci When using ``V4L2_CTRL_WHICH_DEF_VAL`` be aware that you can only 33662306a36Sopenharmony_ci get the default value of the control, you cannot set or try it. 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci For backwards compatibility you can also use a control class here 33962306a36Sopenharmony_ci (see :ref:`ctrl-class`). In that case all controls have to 34062306a36Sopenharmony_ci belong to that control class. This usage is deprecated, instead 34162306a36Sopenharmony_ci just use ``V4L2_CTRL_WHICH_CUR_VAL``. There are some very old 34262306a36Sopenharmony_ci drivers that do not yet support ``V4L2_CTRL_WHICH_CUR_VAL`` and 34362306a36Sopenharmony_ci that require a control class here. You can test for such drivers 34462306a36Sopenharmony_ci by setting ``which`` to ``V4L2_CTRL_WHICH_CUR_VAL`` and calling 34562306a36Sopenharmony_ci :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` with a count of 0. 34662306a36Sopenharmony_ci If that fails, then the driver does not support ``V4L2_CTRL_WHICH_CUR_VAL``. 34762306a36Sopenharmony_ci * - __u32 34862306a36Sopenharmony_ci - ``ctrl_class`` 34962306a36Sopenharmony_ci - Deprecated name kept for backwards compatibility. Use ``which`` instead. 35062306a36Sopenharmony_ci * - } 35162306a36Sopenharmony_ci - 35262306a36Sopenharmony_ci * - __u32 35362306a36Sopenharmony_ci - ``count`` 35462306a36Sopenharmony_ci - The number of controls in the controls array. May also be zero. 35562306a36Sopenharmony_ci * - __u32 35662306a36Sopenharmony_ci - ``error_idx`` 35762306a36Sopenharmony_ci - Index of the failing control. Set by the driver in case of an error. 35862306a36Sopenharmony_ci * - :cspan:`2` If the error is associated 35962306a36Sopenharmony_ci with a particular control, then ``error_idx`` is set to the index 36062306a36Sopenharmony_ci of that control. If the error is not related to a specific 36162306a36Sopenharmony_ci control, or the validation step failed (see below), then 36262306a36Sopenharmony_ci ``error_idx`` is set to ``count``. The value is undefined if the 36362306a36Sopenharmony_ci ioctl returned 0 (success). 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_ci Before controls are read from/written to hardware a validation 36662306a36Sopenharmony_ci step takes place: this checks if all controls in the list are 36762306a36Sopenharmony_ci valid controls, if no attempt is made to write to a read-only 36862306a36Sopenharmony_ci control or read from a write-only control, and any other up-front 36962306a36Sopenharmony_ci checks that can be done without accessing the hardware. The exact 37062306a36Sopenharmony_ci validations done during this step are driver dependent since some 37162306a36Sopenharmony_ci checks might require hardware access for some devices, thus making 37262306a36Sopenharmony_ci it impossible to do those checks up-front. However, drivers should 37362306a36Sopenharmony_ci make a best-effort to do as many up-front checks as possible. 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci This check is done to avoid leaving the hardware in an 37662306a36Sopenharmony_ci inconsistent state due to easy-to-avoid problems. But it leads to 37762306a36Sopenharmony_ci another problem: the application needs to know whether an error 37862306a36Sopenharmony_ci came from the validation step (meaning that the hardware was not 37962306a36Sopenharmony_ci touched) or from an error during the actual reading from/writing 38062306a36Sopenharmony_ci to hardware. 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci The, in hindsight quite poor, solution for that is to set 38362306a36Sopenharmony_ci ``error_idx`` to ``count`` if the validation failed. This has the 38462306a36Sopenharmony_ci unfortunate side-effect that it is not possible to see which 38562306a36Sopenharmony_ci control failed the validation. If the validation was successful 38662306a36Sopenharmony_ci and the error happened while accessing the hardware, then 38762306a36Sopenharmony_ci ``error_idx`` is less than ``count`` and only the controls up to 38862306a36Sopenharmony_ci ``error_idx-1`` were read or written correctly, and the state of 38962306a36Sopenharmony_ci the remaining controls is undefined. 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ci Since :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` does not access hardware there is 39262306a36Sopenharmony_ci also no need to handle the validation step in this special way, so 39362306a36Sopenharmony_ci ``error_idx`` will just be set to the control that failed the 39462306a36Sopenharmony_ci validation step instead of to ``count``. This means that if 39562306a36Sopenharmony_ci :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` fails with ``error_idx`` set to ``count``, 39662306a36Sopenharmony_ci then you can call :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` to try to discover the 39762306a36Sopenharmony_ci actual control that failed the validation step. Unfortunately, 39862306a36Sopenharmony_ci there is no ``TRY`` equivalent for :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`. 39962306a36Sopenharmony_ci * - __s32 40062306a36Sopenharmony_ci - ``request_fd`` 40162306a36Sopenharmony_ci - File descriptor of the request to be used by this operation. Only 40262306a36Sopenharmony_ci valid if ``which`` is set to ``V4L2_CTRL_WHICH_REQUEST_VAL``. 40362306a36Sopenharmony_ci If the device does not support requests, then ``EACCES`` will be returned. 40462306a36Sopenharmony_ci If requests are supported but an invalid request file descriptor is 40562306a36Sopenharmony_ci given, then ``EINVAL`` will be returned. 40662306a36Sopenharmony_ci * - __u32 40762306a36Sopenharmony_ci - ``reserved``\ [1] 40862306a36Sopenharmony_ci - Reserved for future extensions. 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_ci Drivers and applications must set the array to zero. 41162306a36Sopenharmony_ci * - struct :c:type:`v4l2_ext_control` * 41262306a36Sopenharmony_ci - ``controls`` 41362306a36Sopenharmony_ci - Pointer to an array of ``count`` v4l2_ext_control structures. 41462306a36Sopenharmony_ci 41562306a36Sopenharmony_ci Ignored if ``count`` equals zero. 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_ci.. tabularcolumns:: |p{7.3cm}|p{2.0cm}|p{8.0cm}| 41862306a36Sopenharmony_ci 41962306a36Sopenharmony_ci.. cssclass:: longtable 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_ci.. _ctrl-class: 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ci.. flat-table:: Control classes 42462306a36Sopenharmony_ci :header-rows: 0 42562306a36Sopenharmony_ci :stub-columns: 0 42662306a36Sopenharmony_ci :widths: 3 1 4 42762306a36Sopenharmony_ci 42862306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_USER`` 42962306a36Sopenharmony_ci - 0x980000 43062306a36Sopenharmony_ci - The class containing user controls. These controls are described 43162306a36Sopenharmony_ci in :ref:`control`. All controls that can be set using the 43262306a36Sopenharmony_ci :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` and 43362306a36Sopenharmony_ci :ref:`VIDIOC_G_CTRL <VIDIOC_G_CTRL>` ioctl belong to this 43462306a36Sopenharmony_ci class. 43562306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_CODEC`` 43662306a36Sopenharmony_ci - 0x990000 43762306a36Sopenharmony_ci - The class containing stateful codec controls. These controls are 43862306a36Sopenharmony_ci described in :ref:`codec-controls`. 43962306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_CAMERA`` 44062306a36Sopenharmony_ci - 0x9a0000 44162306a36Sopenharmony_ci - The class containing camera controls. These controls are described 44262306a36Sopenharmony_ci in :ref:`camera-controls`. 44362306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_FM_TX`` 44462306a36Sopenharmony_ci - 0x9b0000 44562306a36Sopenharmony_ci - The class containing FM Transmitter (FM TX) controls. These 44662306a36Sopenharmony_ci controls are described in :ref:`fm-tx-controls`. 44762306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_FLASH`` 44862306a36Sopenharmony_ci - 0x9c0000 44962306a36Sopenharmony_ci - The class containing flash device controls. These controls are 45062306a36Sopenharmony_ci described in :ref:`flash-controls`. 45162306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_JPEG`` 45262306a36Sopenharmony_ci - 0x9d0000 45362306a36Sopenharmony_ci - The class containing JPEG compression controls. These controls are 45462306a36Sopenharmony_ci described in :ref:`jpeg-controls`. 45562306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_IMAGE_SOURCE`` 45662306a36Sopenharmony_ci - 0x9e0000 45762306a36Sopenharmony_ci - The class containing image source controls. These controls are 45862306a36Sopenharmony_ci described in :ref:`image-source-controls`. 45962306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_IMAGE_PROC`` 46062306a36Sopenharmony_ci - 0x9f0000 46162306a36Sopenharmony_ci - The class containing image processing controls. These controls are 46262306a36Sopenharmony_ci described in :ref:`image-process-controls`. 46362306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_FM_RX`` 46462306a36Sopenharmony_ci - 0xa10000 46562306a36Sopenharmony_ci - The class containing FM Receiver (FM RX) controls. These controls 46662306a36Sopenharmony_ci are described in :ref:`fm-rx-controls`. 46762306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_RF_TUNER`` 46862306a36Sopenharmony_ci - 0xa20000 46962306a36Sopenharmony_ci - The class containing RF tuner controls. These controls are 47062306a36Sopenharmony_ci described in :ref:`rf-tuner-controls`. 47162306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_DETECT`` 47262306a36Sopenharmony_ci - 0xa30000 47362306a36Sopenharmony_ci - The class containing motion or object detection controls. These controls 47462306a36Sopenharmony_ci are described in :ref:`detect-controls`. 47562306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_CODEC_STATELESS`` 47662306a36Sopenharmony_ci - 0xa40000 47762306a36Sopenharmony_ci - The class containing stateless codec controls. These controls are 47862306a36Sopenharmony_ci described in :ref:`codec-stateless-controls`. 47962306a36Sopenharmony_ci * - ``V4L2_CTRL_CLASS_COLORIMETRY`` 48062306a36Sopenharmony_ci - 0xa50000 48162306a36Sopenharmony_ci - The class containing colorimetry controls. These controls are 48262306a36Sopenharmony_ci described in :ref:`colorimetry-controls`. 48362306a36Sopenharmony_ci 48462306a36Sopenharmony_ciReturn Value 48562306a36Sopenharmony_ci============ 48662306a36Sopenharmony_ci 48762306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 48862306a36Sopenharmony_ciappropriately. The generic error codes are described at the 48962306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 49062306a36Sopenharmony_ci 49162306a36Sopenharmony_ciEINVAL 49262306a36Sopenharmony_ci The struct :c:type:`v4l2_ext_control` ``id`` is 49362306a36Sopenharmony_ci invalid, or the struct :c:type:`v4l2_ext_controls` 49462306a36Sopenharmony_ci ``which`` is invalid, or the struct 49562306a36Sopenharmony_ci :c:type:`v4l2_ext_control` ``value`` was 49662306a36Sopenharmony_ci inappropriate (e.g. the given menu index is not supported by the 49762306a36Sopenharmony_ci driver), or the ``which`` field was set to ``V4L2_CTRL_WHICH_REQUEST_VAL`` 49862306a36Sopenharmony_ci but the given ``request_fd`` was invalid or ``V4L2_CTRL_WHICH_REQUEST_VAL`` 49962306a36Sopenharmony_ci is not supported by the kernel. 50062306a36Sopenharmony_ci This error code is also returned by the 50162306a36Sopenharmony_ci :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` and :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctls if two or 50262306a36Sopenharmony_ci more control values are in conflict. 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_ciERANGE 50562306a36Sopenharmony_ci The struct :c:type:`v4l2_ext_control` ``value`` 50662306a36Sopenharmony_ci is out of bounds. 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_ciEBUSY 50962306a36Sopenharmony_ci The control is temporarily not changeable, possibly because another 51062306a36Sopenharmony_ci applications took over control of the device function this control 51162306a36Sopenharmony_ci belongs to, or (if the ``which`` field was set to 51262306a36Sopenharmony_ci ``V4L2_CTRL_WHICH_REQUEST_VAL``) the request was queued but not yet 51362306a36Sopenharmony_ci completed. 51462306a36Sopenharmony_ci 51562306a36Sopenharmony_ciENOSPC 51662306a36Sopenharmony_ci The space reserved for the control's payload is insufficient. The 51762306a36Sopenharmony_ci field ``size`` is set to a value that is enough to store the payload 51862306a36Sopenharmony_ci and this error code is returned. 51962306a36Sopenharmony_ci 52062306a36Sopenharmony_ciEACCES 52162306a36Sopenharmony_ci Attempt to try or set a read-only control, or to get a write-only 52262306a36Sopenharmony_ci control, or to get a control from a request that has not yet been 52362306a36Sopenharmony_ci completed. 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci Or the ``which`` field was set to ``V4L2_CTRL_WHICH_REQUEST_VAL`` but the 52662306a36Sopenharmony_ci device does not support requests. 52762306a36Sopenharmony_ci 52862306a36Sopenharmony_ci Or if there is an attempt to set an inactive control and the driver is 52962306a36Sopenharmony_ci not capable of caching the new value until the control is active again. 530