538 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2.. c:namespace:: V4L3 4.. _VIDIOC_G_EXT_CTRLS:5 6******************************************************************7ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, VIDIOC_TRY_EXT_CTRLS8******************************************************************9 10Name11====12 13VIDIOC_G_EXT_CTRLS - VIDIOC_S_EXT_CTRLS - VIDIOC_TRY_EXT_CTRLS - Get or set the value of several controls, try control values14 15Synopsis16========17 18.. c:macro:: VIDIOC_G_EXT_CTRLS19 20``int ioctl(int fd, VIDIOC_G_EXT_CTRLS, struct v4l2_ext_controls *argp)``21 22.. c:macro:: VIDIOC_S_EXT_CTRLS23 24``int ioctl(int fd, VIDIOC_S_EXT_CTRLS, struct v4l2_ext_controls *argp)``25 26.. c:macro:: VIDIOC_TRY_EXT_CTRLS27 28``int ioctl(int fd, VIDIOC_TRY_EXT_CTRLS, struct v4l2_ext_controls *argp)``29 30Arguments31=========32 33``fd``34 File descriptor returned by :c:func:`open()`.35 36``argp``37 Pointer to struct :c:type:`v4l2_ext_controls`.38 39Description40===========41 42These ioctls allow the caller to get or set multiple controls43atomically. Control IDs are grouped into control classes (see44:ref:`ctrl-class`) and all controls in the control array must belong45to the same control class.46 47Applications must always fill in the ``count``, ``which``, ``controls``48and ``reserved`` fields of struct49:c:type:`v4l2_ext_controls`, and initialize the50struct :c:type:`v4l2_ext_control` array pointed to51by the ``controls`` fields.52 53To get the current value of a set of controls applications initialize54the ``id``, ``size`` and ``reserved2`` fields of each struct55:c:type:`v4l2_ext_control` and call the56:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. String controls must also set the57``string`` field. Controls of compound types58(``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set) must set the ``ptr`` field.59 60If the ``size`` is too small to receive the control result (only61relevant for pointer-type controls like strings), then the driver will62set ``size`` to a valid value and return an ``ENOSPC`` error code. You63should re-allocate the memory to this new size and try again. For the64string type it is possible that the same issue occurs again if the65string has grown in the meantime. It is recommended to call66:ref:`VIDIOC_QUERYCTRL` first and use67``maximum``\ +1 as the new ``size`` value. It is guaranteed that that is68sufficient memory.69 70N-dimensional arrays are set and retrieved row-by-row. You cannot set a71partial array, all elements have to be set or retrieved. The total size72is calculated as ``elems`` * ``elem_size``. These values can be obtained73by calling :ref:`VIDIOC_QUERY_EXT_CTRL <VIDIOC_QUERYCTRL>`.74 75To change the value of a set of controls applications initialize the76``id``, ``size``, ``reserved2`` and ``value/value64/string/ptr`` fields77of each struct :c:type:`v4l2_ext_control` and call78the :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. The controls will only be set if *all*79control values are valid.80 81To check if a set of controls have correct values applications82initialize the ``id``, ``size``, ``reserved2`` and83``value/value64/string/ptr`` fields of each struct84:c:type:`v4l2_ext_control` and call the85:ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. It is up to the driver whether wrong86values are automatically adjusted to a valid value or if an error is87returned.88 89When the ``id`` or ``which`` is invalid drivers return an ``EINVAL`` error90code. When the value is out of bounds drivers can choose to take the91closest valid value or return an ``ERANGE`` error code, whatever seems more92appropriate. In the first case the new value is set in struct93:c:type:`v4l2_ext_control`. If the new control value94is inappropriate (e.g. the given menu index is not supported by the menu95control), then this will also result in an ``EINVAL`` error code error.96 97If ``request_fd`` is set to a not-yet-queued :ref:`request <media-request-api>`98file descriptor and ``which`` is set to ``V4L2_CTRL_WHICH_REQUEST_VAL``,99then the controls are not applied immediately when calling100:ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`, but instead are applied by101the driver for the buffer associated with the same request.102If the device does not support requests, then ``EACCES`` will be returned.103If requests are supported but an invalid request file descriptor is given,104then ``EINVAL`` will be returned.105 106An attempt to call :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` for a107request that has already been queued will result in an ``EBUSY`` error.108 109If ``request_fd`` is specified and ``which`` is set to110``V4L2_CTRL_WHICH_REQUEST_VAL`` during a call to111:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`, then it will return the112values of the controls at the time of request completion.113If the request is not yet completed, then this will result in an114``EACCES`` error.115 116The driver will only set/get these controls if all control values are117correct. This prevents the situation where only some of the controls118were set/get. Only low-level errors (e. g. a failed i2c command) can119still cause this situation.120 121.. tabularcolumns:: |p{6.8cm}|p{4.0cm}|p{6.5cm}|122 123.. c:type:: v4l2_ext_control124 125.. raw:: latex126 127 \footnotesize128 129.. cssclass:: longtable130 131.. flat-table:: struct v4l2_ext_control132 :header-rows: 0133 :stub-columns: 0134 :widths: 1 1 2135 136 * - __u32137 - ``id``138 - Identifies the control, set by the application.139 * - __u32140 - ``size``141 - The total size in bytes of the payload of this control.142 * - :cspan:`2` The ``size`` field is normally 0, but for pointer143 controls this should be set to the size of the memory that contains144 the payload or that will receive the payload.145 If :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` finds that this value146 is less than is required to store the payload result, then it is set147 to a value large enough to store the payload result and ``ENOSPC`` is148 returned.149 150 .. note::151 152 For string controls, this ``size`` field should153 not be confused with the length of the string. This field refers154 to the size of the memory that contains the string. The actual155 *length* of the string may well be much smaller.156 * - __u32157 - ``reserved2``\ [1]158 - Reserved for future extensions. Drivers and applications must set159 the array to zero.160 * - union {161 - (anonymous)162 * - __s32163 - ``value``164 - New value or current value. Valid if this control is not of type165 ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is166 not set.167 * - __s64168 - ``value64``169 - New value or current value. Valid if this control is of type170 ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is171 not set.172 * - char *173 - ``string``174 - A pointer to a string. Valid if this control is of type175 ``V4L2_CTRL_TYPE_STRING``.176 * - __u8 *177 - ``p_u8``178 - A pointer to a matrix control of unsigned 8-bit values. Valid if179 this control is of type ``V4L2_CTRL_TYPE_U8``.180 * - __u16 *181 - ``p_u16``182 - A pointer to a matrix control of unsigned 16-bit values. Valid if183 this control is of type ``V4L2_CTRL_TYPE_U16``.184 * - __u32 *185 - ``p_u32``186 - A pointer to a matrix control of unsigned 32-bit values. Valid if187 this control is of type ``V4L2_CTRL_TYPE_U32``.188 * - __s32 *189 - ``p_s32``190 - A pointer to a matrix control of signed 32-bit values. Valid if191 this control is of type ``V4L2_CTRL_TYPE_INTEGER`` and192 ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set.193 * - __s64 *194 - ``p_s64``195 - A pointer to a matrix control of signed 64-bit values. Valid if196 this control is of type ``V4L2_CTRL_TYPE_INTEGER64`` and197 ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set.198 * - struct :c:type:`v4l2_area` *199 - ``p_area``200 - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is201 of type ``V4L2_CTRL_TYPE_AREA``.202 * - struct :c:type:`v4l2_ctrl_h264_sps` *203 - ``p_h264_sps``204 - A pointer to a struct :c:type:`v4l2_ctrl_h264_sps`. Valid if this control is205 of type ``V4L2_CTRL_TYPE_H264_SPS``.206 * - struct :c:type:`v4l2_ctrl_h264_pps` *207 - ``p_h264_pps``208 - A pointer to a struct :c:type:`v4l2_ctrl_h264_pps`. Valid if this control is209 of type ``V4L2_CTRL_TYPE_H264_PPS``.210 * - struct :c:type:`v4l2_ctrl_h264_scaling_matrix` *211 - ``p_h264_scaling_matrix``212 - A pointer to a struct :c:type:`v4l2_ctrl_h264_scaling_matrix`. Valid if this control is213 of type ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``.214 * - struct :c:type:`v4l2_ctrl_h264_pred_weights` *215 - ``p_h264_pred_weights``216 - A pointer to a struct :c:type:`v4l2_ctrl_h264_pred_weights`. Valid if this control is217 of type ``V4L2_CTRL_TYPE_H264_PRED_WEIGHTS``.218 * - struct :c:type:`v4l2_ctrl_h264_slice_params` *219 - ``p_h264_slice_params``220 - A pointer to a struct :c:type:`v4l2_ctrl_h264_slice_params`. Valid if this control is221 of type ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``.222 * - struct :c:type:`v4l2_ctrl_h264_decode_params` *223 - ``p_h264_decode_params``224 - A pointer to a struct :c:type:`v4l2_ctrl_h264_decode_params`. Valid if this control is225 of type ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``.226 * - struct :c:type:`v4l2_ctrl_fwht_params` *227 - ``p_fwht_params``228 - A pointer to a struct :c:type:`v4l2_ctrl_fwht_params`. Valid if this control is229 of type ``V4L2_CTRL_TYPE_FWHT_PARAMS``.230 * - struct :c:type:`v4l2_ctrl_vp8_frame` *231 - ``p_vp8_frame``232 - A pointer to a struct :c:type:`v4l2_ctrl_vp8_frame`. Valid if this control is233 of type ``V4L2_CTRL_TYPE_VP8_FRAME``.234 * - struct :c:type:`v4l2_ctrl_mpeg2_sequence` *235 - ``p_mpeg2_sequence``236 - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_sequence`. Valid if this control is237 of type ``V4L2_CTRL_TYPE_MPEG2_SEQUENCE``.238 * - struct :c:type:`v4l2_ctrl_mpeg2_picture` *239 - ``p_mpeg2_picture``240 - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_picture`. Valid if this control is241 of type ``V4L2_CTRL_TYPE_MPEG2_PICTURE``.242 * - struct :c:type:`v4l2_ctrl_mpeg2_quantisation` *243 - ``p_mpeg2_quantisation``244 - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_quantisation`. Valid if this control is245 of type ``V4L2_CTRL_TYPE_MPEG2_QUANTISATION``.246 * - struct :c:type:`v4l2_ctrl_vp9_compressed_hdr` *247 - ``p_vp9_compressed_hdr_probs``248 - A pointer to a struct :c:type:`v4l2_ctrl_vp9_compressed_hdr`. Valid if this249 control is of type ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR``.250 * - struct :c:type:`v4l2_ctrl_vp9_frame` *251 - ``p_vp9_frame``252 - A pointer to a struct :c:type:`v4l2_ctrl_vp9_frame`. Valid if this253 control is of type ``V4L2_CTRL_TYPE_VP9_FRAME``.254 * - struct :c:type:`v4l2_ctrl_hdr10_cll_info` *255 - ``p_hdr10_cll``256 - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_cll_info`. Valid if this control is257 of type ``V4L2_CTRL_TYPE_HDR10_CLL_INFO``.258 * - struct :c:type:`v4l2_ctrl_hdr10_mastering_display` *259 - ``p_hdr10_mastering``260 - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_mastering_display`. Valid if this control is261 of type ``V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY``.262 * - struct :c:type:`v4l2_ctrl_hevc_sps` *263 - ``p_hevc_sps``264 - A pointer to a struct :c:type:`v4l2_ctrl_hevc_sps`. Valid if this265 control is of type ``V4L2_CTRL_TYPE_HEVC_SPS``.266 * - struct :c:type:`v4l2_ctrl_hevc_pps` *267 - ``p_hevc_pps``268 - A pointer to a struct :c:type:`v4l2_ctrl_hevc_pps`. Valid if this269 control is of type ``V4L2_CTRL_TYPE_HEVC_PPS``.270 * - struct :c:type:`v4l2_ctrl_hevc_slice_params` *271 - ``p_hevc_slice_params``272 - A pointer to a struct :c:type:`v4l2_ctrl_hevc_slice_params`. Valid if this273 control is of type ``V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS``.274 * - struct :c:type:`v4l2_ctrl_hevc_scaling_matrix` *275 - ``p_hevc_scaling_matrix``276 - A pointer to a struct :c:type:`v4l2_ctrl_hevc_scaling_matrix`. Valid if this277 control is of type ``V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX``.278 * - struct :c:type:`v4l2_ctrl_hevc_decode_params` *279 - ``p_hevc_decode_params``280 - A pointer to a struct :c:type:`v4l2_ctrl_hevc_decode_params`. Valid if this281 control is of type ``V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS``.282 * - struct :c:type:`v4l2_ctrl_av1_sequence` *283 - ``p_av1_sequence``284 - A pointer to a struct :c:type:`v4l2_ctrl_av1_sequence`. Valid if this control is285 of type ``V4L2_CTRL_TYPE_AV1_SEQUENCE``.286 * - struct :c:type:`v4l2_ctrl_av1_tile_group_entry` *287 - ``p_av1_tile_group_entry``288 - A pointer to a struct :c:type:`v4l2_ctrl_av1_tile_group_entry`. Valid if this control is289 of type ``V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY``.290 * - struct :c:type:`v4l2_ctrl_av1_frame` *291 - ``p_av1_frame``292 - A pointer to a struct :c:type:`v4l2_ctrl_av1_frame`. Valid if this control is293 of type ``V4L2_CTRL_TYPE_AV1_FRAME``.294 * - struct :c:type:`v4l2_ctrl_av1_film_grain` *295 - ``p_av1_film_grain``296 - A pointer to a struct :c:type:`v4l2_ctrl_av1_film_grain`. Valid if this control is297 of type ``V4L2_CTRL_TYPE_AV1_FILM_GRAIN``.298 * - struct :c:type:`v4l2_ctrl_hdr10_cll_info` *299 - ``p_hdr10_cll_info``300 - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_cll_info`. Valid if this control is301 of type ``V4L2_CTRL_TYPE_HDR10_CLL_INFO``.302 * - struct :c:type:`v4l2_ctrl_hdr10_mastering_display` *303 - ``p_hdr10_mastering_display``304 - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_mastering_display`. Valid if this control is305 of type ``V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY``.306 * - void *307 - ``ptr``308 - A pointer to a compound type which can be an N-dimensional array309 and/or a compound type (the control's type is >=310 ``V4L2_CTRL_COMPOUND_TYPES``). Valid if311 ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set for this control.312 * - }313 -314 315.. raw:: latex316 317 \normalsize318 319.. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{10.8cm}|320 321.. c:type:: v4l2_ext_controls322 323.. cssclass:: longtable324 325.. flat-table:: struct v4l2_ext_controls326 :header-rows: 0327 :stub-columns: 0328 :widths: 1 1 2329 330 * - union {331 - (anonymous)332 * - __u32333 - ``which``334 - Which value of the control to get/set/try.335 * - :cspan:`2` ``V4L2_CTRL_WHICH_CUR_VAL`` will return the current value of336 the control, ``V4L2_CTRL_WHICH_DEF_VAL`` will return the default337 value of the control and ``V4L2_CTRL_WHICH_REQUEST_VAL`` indicates that338 these controls have to be retrieved from a request or tried/set for339 a request. In the latter case the ``request_fd`` field contains the340 file descriptor of the request that should be used. If the device341 does not support requests, then ``EACCES`` will be returned.342 343 When using ``V4L2_CTRL_WHICH_DEF_VAL`` be aware that you can only344 get the default value of the control, you cannot set or try it.345 346 For backwards compatibility you can also use a control class here347 (see :ref:`ctrl-class`). In that case all controls have to348 belong to that control class. This usage is deprecated, instead349 just use ``V4L2_CTRL_WHICH_CUR_VAL``. There are some very old350 drivers that do not yet support ``V4L2_CTRL_WHICH_CUR_VAL`` and351 that require a control class here. You can test for such drivers352 by setting ``which`` to ``V4L2_CTRL_WHICH_CUR_VAL`` and calling353 :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` with a count of 0.354 If that fails, then the driver does not support ``V4L2_CTRL_WHICH_CUR_VAL``.355 * - __u32356 - ``ctrl_class``357 - Deprecated name kept for backwards compatibility. Use ``which`` instead.358 * - }359 -360 * - __u32361 - ``count``362 - The number of controls in the controls array. May also be zero.363 * - __u32364 - ``error_idx``365 - Index of the failing control. Set by the driver in case of an error.366 * - :cspan:`2` If the error is associated367 with a particular control, then ``error_idx`` is set to the index368 of that control. If the error is not related to a specific369 control, or the validation step failed (see below), then370 ``error_idx`` is set to ``count``. The value is undefined if the371 ioctl returned 0 (success).372 373 Before controls are read from/written to hardware a validation374 step takes place: this checks if all controls in the list are375 valid controls, if no attempt is made to write to a read-only376 control or read from a write-only control, and any other up-front377 checks that can be done without accessing the hardware. The exact378 validations done during this step are driver dependent since some379 checks might require hardware access for some devices, thus making380 it impossible to do those checks up-front. However, drivers should381 make a best-effort to do as many up-front checks as possible.382 383 This check is done to avoid leaving the hardware in an384 inconsistent state due to easy-to-avoid problems. But it leads to385 another problem: the application needs to know whether an error386 came from the validation step (meaning that the hardware was not387 touched) or from an error during the actual reading from/writing388 to hardware.389 390 The, in hindsight quite poor, solution for that is to set391 ``error_idx`` to ``count`` if the validation failed. This has the392 unfortunate side-effect that it is not possible to see which393 control failed the validation. If the validation was successful394 and the error happened while accessing the hardware, then395 ``error_idx`` is less than ``count`` and only the controls up to396 ``error_idx-1`` were read or written correctly, and the state of397 the remaining controls is undefined.398 399 Since :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` does not access hardware there is400 also no need to handle the validation step in this special way, so401 ``error_idx`` will just be set to the control that failed the402 validation step instead of to ``count``. This means that if403 :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` fails with ``error_idx`` set to ``count``,404 then you can call :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` to try to discover the405 actual control that failed the validation step. Unfortunately,406 there is no ``TRY`` equivalent for :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`.407 * - __s32408 - ``request_fd``409 - File descriptor of the request to be used by this operation. Only410 valid if ``which`` is set to ``V4L2_CTRL_WHICH_REQUEST_VAL``.411 If the device does not support requests, then ``EACCES`` will be returned.412 If requests are supported but an invalid request file descriptor is413 given, then ``EINVAL`` will be returned.414 * - __u32415 - ``reserved``\ [1]416 - Reserved for future extensions.417 418 Drivers and applications must set the array to zero.419 * - struct :c:type:`v4l2_ext_control` *420 - ``controls``421 - Pointer to an array of ``count`` v4l2_ext_control structures.422 423 Ignored if ``count`` equals zero.424 425.. tabularcolumns:: |p{7.3cm}|p{2.0cm}|p{8.0cm}|426 427.. cssclass:: longtable428 429.. _ctrl-class:430 431.. flat-table:: Control classes432 :header-rows: 0433 :stub-columns: 0434 :widths: 3 1 4435 436 * - ``V4L2_CTRL_CLASS_USER``437 - 0x980000438 - The class containing user controls. These controls are described439 in :ref:`control`. All controls that can be set using the440 :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` and441 :ref:`VIDIOC_G_CTRL <VIDIOC_G_CTRL>` ioctl belong to this442 class.443 * - ``V4L2_CTRL_CLASS_CODEC``444 - 0x990000445 - The class containing stateful codec controls. These controls are446 described in :ref:`codec-controls`.447 * - ``V4L2_CTRL_CLASS_CAMERA``448 - 0x9a0000449 - The class containing camera controls. These controls are described450 in :ref:`camera-controls`.451 * - ``V4L2_CTRL_CLASS_FM_TX``452 - 0x9b0000453 - The class containing FM Transmitter (FM TX) controls. These454 controls are described in :ref:`fm-tx-controls`.455 * - ``V4L2_CTRL_CLASS_FLASH``456 - 0x9c0000457 - The class containing flash device controls. These controls are458 described in :ref:`flash-controls`.459 * - ``V4L2_CTRL_CLASS_JPEG``460 - 0x9d0000461 - The class containing JPEG compression controls. These controls are462 described in :ref:`jpeg-controls`.463 * - ``V4L2_CTRL_CLASS_IMAGE_SOURCE``464 - 0x9e0000465 - The class containing image source controls. These controls are466 described in :ref:`image-source-controls`.467 * - ``V4L2_CTRL_CLASS_IMAGE_PROC``468 - 0x9f0000469 - The class containing image processing controls. These controls are470 described in :ref:`image-process-controls`.471 * - ``V4L2_CTRL_CLASS_FM_RX``472 - 0xa10000473 - The class containing FM Receiver (FM RX) controls. These controls474 are described in :ref:`fm-rx-controls`.475 * - ``V4L2_CTRL_CLASS_RF_TUNER``476 - 0xa20000477 - The class containing RF tuner controls. These controls are478 described in :ref:`rf-tuner-controls`.479 * - ``V4L2_CTRL_CLASS_DETECT``480 - 0xa30000481 - The class containing motion or object detection controls. These controls482 are described in :ref:`detect-controls`.483 * - ``V4L2_CTRL_CLASS_CODEC_STATELESS``484 - 0xa40000485 - The class containing stateless codec controls. These controls are486 described in :ref:`codec-stateless-controls`.487 * - ``V4L2_CTRL_CLASS_COLORIMETRY``488 - 0xa50000489 - The class containing colorimetry controls. These controls are490 described in :ref:`colorimetry-controls`.491 492Return Value493============494 495On success 0 is returned, on error -1 and the ``errno`` variable is set496appropriately. The generic error codes are described at the497:ref:`Generic Error Codes <gen-errors>` chapter.498 499EINVAL500 The struct :c:type:`v4l2_ext_control` ``id`` is501 invalid, or the struct :c:type:`v4l2_ext_controls`502 ``which`` is invalid, or the struct503 :c:type:`v4l2_ext_control` ``value`` was504 inappropriate (e.g. the given menu index is not supported by the505 driver), or the ``which`` field was set to ``V4L2_CTRL_WHICH_REQUEST_VAL``506 but the given ``request_fd`` was invalid or ``V4L2_CTRL_WHICH_REQUEST_VAL``507 is not supported by the kernel.508 This error code is also returned by the509 :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` and :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctls if two or510 more control values are in conflict.511 512ERANGE513 The struct :c:type:`v4l2_ext_control` ``value``514 is out of bounds.515 516EBUSY517 The control is temporarily not changeable, possibly because another518 applications took over control of the device function this control519 belongs to, or (if the ``which`` field was set to520 ``V4L2_CTRL_WHICH_REQUEST_VAL``) the request was queued but not yet521 completed.522 523ENOSPC524 The space reserved for the control's payload is insufficient. The525 field ``size`` is set to a value that is enough to store the payload526 and this error code is returned.527 528EACCES529 Attempt to try or set a read-only control, or to get a write-only530 control, or to get a control from a request that has not yet been531 completed.532 533 Or the ``which`` field was set to ``V4L2_CTRL_WHICH_REQUEST_VAL`` but the534 device does not support requests.535 536 Or if there is an attempt to set an inactive control and the driver is537 not capable of caching the new value until the control is active again.538