1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2*4882a593Smuzhiyun.. c:namespace:: V4L 3*4882a593Smuzhiyun 4*4882a593Smuzhiyun.. _VIDIOC_G_EXT_CTRLS: 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun****************************************************************** 7*4882a593Smuzhiyunioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, VIDIOC_TRY_EXT_CTRLS 8*4882a593Smuzhiyun****************************************************************** 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunName 11*4882a593Smuzhiyun==== 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunVIDIOC_G_EXT_CTRLS - VIDIOC_S_EXT_CTRLS - VIDIOC_TRY_EXT_CTRLS - Get or set the value of several controls, try control values 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunSynopsis 16*4882a593Smuzhiyun======== 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun.. c:macro:: VIDIOC_G_EXT_CTRLS 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_G_EXT_CTRLS, struct v4l2_ext_controls *argp)`` 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun.. c:macro:: VIDIOC_S_EXT_CTRLS 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_S_EXT_CTRLS, struct v4l2_ext_controls *argp)`` 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun.. c:macro:: VIDIOC_TRY_EXT_CTRLS 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_TRY_EXT_CTRLS, struct v4l2_ext_controls *argp)`` 29*4882a593Smuzhiyun 30*4882a593SmuzhiyunArguments 31*4882a593Smuzhiyun========= 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun``fd`` 34*4882a593Smuzhiyun File descriptor returned by :c:func:`open()`. 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun``argp`` 37*4882a593Smuzhiyun Pointer to struct :c:type:`v4l2_ext_controls`. 38*4882a593Smuzhiyun 39*4882a593SmuzhiyunDescription 40*4882a593Smuzhiyun=========== 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunThese ioctls allow the caller to get or set multiple controls 43*4882a593Smuzhiyunatomically. Control IDs are grouped into control classes (see 44*4882a593Smuzhiyun:ref:`ctrl-class`) and all controls in the control array must belong 45*4882a593Smuzhiyunto the same control class. 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunApplications must always fill in the ``count``, ``which``, ``controls`` 48*4882a593Smuzhiyunand ``reserved`` fields of struct 49*4882a593Smuzhiyun:c:type:`v4l2_ext_controls`, and initialize the 50*4882a593Smuzhiyunstruct :c:type:`v4l2_ext_control` array pointed to 51*4882a593Smuzhiyunby the ``controls`` fields. 52*4882a593Smuzhiyun 53*4882a593SmuzhiyunTo get the current value of a set of controls applications initialize 54*4882a593Smuzhiyunthe ``id``, ``size`` and ``reserved2`` fields of each struct 55*4882a593Smuzhiyun:c:type:`v4l2_ext_control` and call the 56*4882a593Smuzhiyun:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. String controls controls must also set the 57*4882a593Smuzhiyun``string`` field. Controls of compound types 58*4882a593Smuzhiyun(``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set) must set the ``ptr`` field. 59*4882a593Smuzhiyun 60*4882a593SmuzhiyunIf the ``size`` is too small to receive the control result (only 61*4882a593Smuzhiyunrelevant for pointer-type controls like strings), then the driver will 62*4882a593Smuzhiyunset ``size`` to a valid value and return an ``ENOSPC`` error code. You 63*4882a593Smuzhiyunshould re-allocate the memory to this new size and try again. For the 64*4882a593Smuzhiyunstring type it is possible that the same issue occurs again if the 65*4882a593Smuzhiyunstring has grown in the meantime. It is recommended to call 66*4882a593Smuzhiyun:ref:`VIDIOC_QUERYCTRL` first and use 67*4882a593Smuzhiyun``maximum``\ +1 as the new ``size`` value. It is guaranteed that that is 68*4882a593Smuzhiyunsufficient memory. 69*4882a593Smuzhiyun 70*4882a593SmuzhiyunN-dimensional arrays are set and retrieved row-by-row. You cannot set a 71*4882a593Smuzhiyunpartial array, all elements have to be set or retrieved. The total size 72*4882a593Smuzhiyunis calculated as ``elems`` * ``elem_size``. These values can be obtained 73*4882a593Smuzhiyunby calling :ref:`VIDIOC_QUERY_EXT_CTRL <VIDIOC_QUERYCTRL>`. 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunTo change the value of a set of controls applications initialize the 76*4882a593Smuzhiyun``id``, ``size``, ``reserved2`` and ``value/value64/string/ptr`` fields 77*4882a593Smuzhiyunof each struct :c:type:`v4l2_ext_control` and call 78*4882a593Smuzhiyunthe :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. The controls will only be set if *all* 79*4882a593Smuzhiyuncontrol values are valid. 80*4882a593Smuzhiyun 81*4882a593SmuzhiyunTo check if a set of controls have correct values applications 82*4882a593Smuzhiyuninitialize the ``id``, ``size``, ``reserved2`` and 83*4882a593Smuzhiyun``value/value64/string/ptr`` fields of each struct 84*4882a593Smuzhiyun:c:type:`v4l2_ext_control` and call the 85*4882a593Smuzhiyun:ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctl. It is up to the driver whether wrong 86*4882a593Smuzhiyunvalues are automatically adjusted to a valid value or if an error is 87*4882a593Smuzhiyunreturned. 88*4882a593Smuzhiyun 89*4882a593SmuzhiyunWhen the ``id`` or ``which`` is invalid drivers return an ``EINVAL`` error 90*4882a593Smuzhiyuncode. When the value is out of bounds drivers can choose to take the 91*4882a593Smuzhiyunclosest valid value or return an ``ERANGE`` error code, whatever seems more 92*4882a593Smuzhiyunappropriate. In the first case the new value is set in struct 93*4882a593Smuzhiyun:c:type:`v4l2_ext_control`. If the new control value 94*4882a593Smuzhiyunis inappropriate (e.g. the given menu index is not supported by the menu 95*4882a593Smuzhiyuncontrol), then this will also result in an ``EINVAL`` error code error. 96*4882a593Smuzhiyun 97*4882a593SmuzhiyunIf ``request_fd`` is set to a not-yet-queued :ref:`request <media-request-api>` 98*4882a593Smuzhiyunfile descriptor and ``which`` is set to ``V4L2_CTRL_WHICH_REQUEST_VAL``, 99*4882a593Smuzhiyunthen the controls are not applied immediately when calling 100*4882a593Smuzhiyun:ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`, but instead are applied by 101*4882a593Smuzhiyunthe driver for the buffer associated with the same request. 102*4882a593SmuzhiyunIf the device does not support requests, then ``EACCES`` will be returned. 103*4882a593SmuzhiyunIf requests are supported but an invalid request file descriptor is given, 104*4882a593Smuzhiyunthen ``EINVAL`` will be returned. 105*4882a593Smuzhiyun 106*4882a593SmuzhiyunAn attempt to call :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` for a 107*4882a593Smuzhiyunrequest that has already been queued will result in an ``EBUSY`` error. 108*4882a593Smuzhiyun 109*4882a593SmuzhiyunIf ``request_fd`` is specified and ``which`` is set to 110*4882a593Smuzhiyun``V4L2_CTRL_WHICH_REQUEST_VAL`` during a call to 111*4882a593Smuzhiyun:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`, then it will return the 112*4882a593Smuzhiyunvalues of the controls at the time of request completion. 113*4882a593SmuzhiyunIf the request is not yet completed, then this will result in an 114*4882a593Smuzhiyun``EACCES`` error. 115*4882a593Smuzhiyun 116*4882a593SmuzhiyunThe driver will only set/get these controls if all control values are 117*4882a593Smuzhiyuncorrect. This prevents the situation where only some of the controls 118*4882a593Smuzhiyunwere set/get. Only low-level errors (e. g. a failed i2c command) can 119*4882a593Smuzhiyunstill cause this situation. 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun.. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{1.5cm}|p{11.8cm}| 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun.. c:type:: v4l2_ext_control 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun.. cssclass: longtable 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun.. flat-table:: struct v4l2_ext_control 128*4882a593Smuzhiyun :header-rows: 0 129*4882a593Smuzhiyun :stub-columns: 0 130*4882a593Smuzhiyun :widths: 1 1 2 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun * - __u32 133*4882a593Smuzhiyun - ``id`` 134*4882a593Smuzhiyun - Identifies the control, set by the application. 135*4882a593Smuzhiyun * - __u32 136*4882a593Smuzhiyun - ``size`` 137*4882a593Smuzhiyun - The total size in bytes of the payload of this control. This is 138*4882a593Smuzhiyun normally 0, but for pointer controls this should be set to the 139*4882a593Smuzhiyun size of the memory containing the payload, or that will receive 140*4882a593Smuzhiyun the payload. If :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` finds that this value is 141*4882a593Smuzhiyun less than is required to store the payload result, then it is set 142*4882a593Smuzhiyun to a value large enough to store the payload result and ``ENOSPC`` is 143*4882a593Smuzhiyun returned. 144*4882a593Smuzhiyun 145*4882a593Smuzhiyun .. note:: 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun For string controls, this ``size`` field should 148*4882a593Smuzhiyun not be confused with the length of the string. This field refers 149*4882a593Smuzhiyun to the size of the memory that contains the string. The actual 150*4882a593Smuzhiyun *length* of the string may well be much smaller. 151*4882a593Smuzhiyun * - __u32 152*4882a593Smuzhiyun - ``reserved2``\ [1] 153*4882a593Smuzhiyun - Reserved for future extensions. Drivers and applications must set 154*4882a593Smuzhiyun the array to zero. 155*4882a593Smuzhiyun * - union { 156*4882a593Smuzhiyun - (anonymous) 157*4882a593Smuzhiyun * - __s32 158*4882a593Smuzhiyun - ``value`` 159*4882a593Smuzhiyun - New value or current value. Valid if this control is not of type 160*4882a593Smuzhiyun ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is 161*4882a593Smuzhiyun not set. 162*4882a593Smuzhiyun * - __s64 163*4882a593Smuzhiyun - ``value64`` 164*4882a593Smuzhiyun - New value or current value. Valid if this control is of type 165*4882a593Smuzhiyun ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is 166*4882a593Smuzhiyun not set. 167*4882a593Smuzhiyun * - char * 168*4882a593Smuzhiyun - ``string`` 169*4882a593Smuzhiyun - A pointer to a string. Valid if this control is of type 170*4882a593Smuzhiyun ``V4L2_CTRL_TYPE_STRING``. 171*4882a593Smuzhiyun * - __u8 * 172*4882a593Smuzhiyun - ``p_u8`` 173*4882a593Smuzhiyun - A pointer to a matrix control of unsigned 8-bit values. Valid if 174*4882a593Smuzhiyun this control is of type ``V4L2_CTRL_TYPE_U8``. 175*4882a593Smuzhiyun * - __u16 * 176*4882a593Smuzhiyun - ``p_u16`` 177*4882a593Smuzhiyun - A pointer to a matrix control of unsigned 16-bit values. Valid if 178*4882a593Smuzhiyun this control is of type ``V4L2_CTRL_TYPE_U16``. 179*4882a593Smuzhiyun * - __u32 * 180*4882a593Smuzhiyun - ``p_u32`` 181*4882a593Smuzhiyun - A pointer to a matrix control of unsigned 32-bit values. Valid if 182*4882a593Smuzhiyun this control is of type ``V4L2_CTRL_TYPE_U32``. 183*4882a593Smuzhiyun * - :c:type:`v4l2_area` * 184*4882a593Smuzhiyun - ``p_area`` 185*4882a593Smuzhiyun - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is 186*4882a593Smuzhiyun of type ``V4L2_CTRL_TYPE_AREA``. 187*4882a593Smuzhiyun * - struct :c:type:`v4l2_ctrl_hdr10_cll_info` * 188*4882a593Smuzhiyun - ``p_hdr10_cll`` 189*4882a593Smuzhiyun - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_cll_info`. Valid if this control is 190*4882a593Smuzhiyun of type ``V4L2_CTRL_TYPE_HDR10_CLL_INFO``. 191*4882a593Smuzhiyun * - struct :c:type:`v4l2_ctrl_hdr10_mastering_display` * 192*4882a593Smuzhiyun - ``p_hdr10_mastering`` 193*4882a593Smuzhiyun - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_mastering_display`. Valid if this control is 194*4882a593Smuzhiyun of type ``V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY``. 195*4882a593Smuzhiyun * - void * 196*4882a593Smuzhiyun - ``ptr`` 197*4882a593Smuzhiyun - A pointer to a compound type which can be an N-dimensional array 198*4882a593Smuzhiyun and/or a compound type (the control's type is >= 199*4882a593Smuzhiyun ``V4L2_CTRL_COMPOUND_TYPES``). Valid if 200*4882a593Smuzhiyun ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set for this control. 201*4882a593Smuzhiyun * - } 202*4882a593Smuzhiyun - 203*4882a593Smuzhiyun 204*4882a593Smuzhiyun.. tabularcolumns:: |p{4.0cm}|p{2.2cm}|p{2.1cm}|p{8.2cm}| 205*4882a593Smuzhiyun 206*4882a593Smuzhiyun.. c:type:: v4l2_ext_controls 207*4882a593Smuzhiyun 208*4882a593Smuzhiyun.. cssclass:: longtable 209*4882a593Smuzhiyun 210*4882a593Smuzhiyun.. flat-table:: struct v4l2_ext_controls 211*4882a593Smuzhiyun :header-rows: 0 212*4882a593Smuzhiyun :stub-columns: 0 213*4882a593Smuzhiyun :widths: 1 1 2 214*4882a593Smuzhiyun 215*4882a593Smuzhiyun * - union { 216*4882a593Smuzhiyun - (anonymous) 217*4882a593Smuzhiyun * - __u32 218*4882a593Smuzhiyun - ``ctrl_class`` 219*4882a593Smuzhiyun - The control class to which all controls belong, see 220*4882a593Smuzhiyun :ref:`ctrl-class`. Drivers that use a kernel framework for 221*4882a593Smuzhiyun handling controls will also accept a value of 0 here, meaning that 222*4882a593Smuzhiyun the controls can belong to any control class. Whether drivers 223*4882a593Smuzhiyun support this can be tested by setting ``ctrl_class`` to 0 and 224*4882a593Smuzhiyun calling :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` with a ``count`` of 0. If that 225*4882a593Smuzhiyun succeeds, then the driver supports this feature. 226*4882a593Smuzhiyun * - __u32 227*4882a593Smuzhiyun - ``which`` 228*4882a593Smuzhiyun - Which value of the control to get/set/try. 229*4882a593Smuzhiyun ``V4L2_CTRL_WHICH_CUR_VAL`` will return the current value of the 230*4882a593Smuzhiyun control, ``V4L2_CTRL_WHICH_DEF_VAL`` will return the default 231*4882a593Smuzhiyun value of the control and ``V4L2_CTRL_WHICH_REQUEST_VAL`` indicates that 232*4882a593Smuzhiyun these controls have to be retrieved from a request or tried/set for 233*4882a593Smuzhiyun a request. In the latter case the ``request_fd`` field contains the 234*4882a593Smuzhiyun file descriptor of the request that should be used. If the device 235*4882a593Smuzhiyun does not support requests, then ``EACCES`` will be returned. 236*4882a593Smuzhiyun 237*4882a593Smuzhiyun .. note:: 238*4882a593Smuzhiyun 239*4882a593Smuzhiyun When using ``V4L2_CTRL_WHICH_DEF_VAL`` be aware that you can only 240*4882a593Smuzhiyun get the default value of the control, you cannot set or try it. 241*4882a593Smuzhiyun 242*4882a593Smuzhiyun For backwards compatibility you can also use a control class here 243*4882a593Smuzhiyun (see :ref:`ctrl-class`). In that case all controls have to 244*4882a593Smuzhiyun belong to that control class. This usage is deprecated, instead 245*4882a593Smuzhiyun just use ``V4L2_CTRL_WHICH_CUR_VAL``. There are some very old 246*4882a593Smuzhiyun drivers that do not yet support ``V4L2_CTRL_WHICH_CUR_VAL`` and 247*4882a593Smuzhiyun that require a control class here. You can test for such drivers 248*4882a593Smuzhiyun by setting ctrl_class to ``V4L2_CTRL_WHICH_CUR_VAL`` and calling 249*4882a593Smuzhiyun VIDIOC_TRY_EXT_CTRLS with a count of 0. If that fails, then the 250*4882a593Smuzhiyun driver does not support ``V4L2_CTRL_WHICH_CUR_VAL``. 251*4882a593Smuzhiyun * - } 252*4882a593Smuzhiyun - 253*4882a593Smuzhiyun * - __u32 254*4882a593Smuzhiyun - ``count`` 255*4882a593Smuzhiyun - The number of controls in the controls array. May also be zero. 256*4882a593Smuzhiyun * - __u32 257*4882a593Smuzhiyun - ``error_idx`` 258*4882a593Smuzhiyun - Set by the driver in case of an error. If the error is associated 259*4882a593Smuzhiyun with a particular control, then ``error_idx`` is set to the index 260*4882a593Smuzhiyun of that control. If the error is not related to a specific 261*4882a593Smuzhiyun control, or the validation step failed (see below), then 262*4882a593Smuzhiyun ``error_idx`` is set to ``count``. The value is undefined if the 263*4882a593Smuzhiyun ioctl returned 0 (success). 264*4882a593Smuzhiyun 265*4882a593Smuzhiyun Before controls are read from/written to hardware a validation 266*4882a593Smuzhiyun step takes place: this checks if all controls in the list are 267*4882a593Smuzhiyun valid controls, if no attempt is made to write to a read-only 268*4882a593Smuzhiyun control or read from a write-only control, and any other up-front 269*4882a593Smuzhiyun checks that can be done without accessing the hardware. The exact 270*4882a593Smuzhiyun validations done during this step are driver dependent since some 271*4882a593Smuzhiyun checks might require hardware access for some devices, thus making 272*4882a593Smuzhiyun it impossible to do those checks up-front. However, drivers should 273*4882a593Smuzhiyun make a best-effort to do as many up-front checks as possible. 274*4882a593Smuzhiyun 275*4882a593Smuzhiyun This check is done to avoid leaving the hardware in an 276*4882a593Smuzhiyun inconsistent state due to easy-to-avoid problems. But it leads to 277*4882a593Smuzhiyun another problem: the application needs to know whether an error 278*4882a593Smuzhiyun came from the validation step (meaning that the hardware was not 279*4882a593Smuzhiyun touched) or from an error during the actual reading from/writing 280*4882a593Smuzhiyun to hardware. 281*4882a593Smuzhiyun 282*4882a593Smuzhiyun The, in hindsight quite poor, solution for that is to set 283*4882a593Smuzhiyun ``error_idx`` to ``count`` if the validation failed. This has the 284*4882a593Smuzhiyun unfortunate side-effect that it is not possible to see which 285*4882a593Smuzhiyun control failed the validation. If the validation was successful 286*4882a593Smuzhiyun and the error happened while accessing the hardware, then 287*4882a593Smuzhiyun ``error_idx`` is less than ``count`` and only the controls up to 288*4882a593Smuzhiyun ``error_idx-1`` were read or written correctly, and the state of 289*4882a593Smuzhiyun the remaining controls is undefined. 290*4882a593Smuzhiyun 291*4882a593Smuzhiyun Since :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` does not access hardware there is 292*4882a593Smuzhiyun also no need to handle the validation step in this special way, so 293*4882a593Smuzhiyun ``error_idx`` will just be set to the control that failed the 294*4882a593Smuzhiyun validation step instead of to ``count``. This means that if 295*4882a593Smuzhiyun :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` fails with ``error_idx`` set to ``count``, 296*4882a593Smuzhiyun then you can call :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` to try to discover the 297*4882a593Smuzhiyun actual control that failed the validation step. Unfortunately, 298*4882a593Smuzhiyun there is no ``TRY`` equivalent for :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`. 299*4882a593Smuzhiyun * - __s32 300*4882a593Smuzhiyun - ``request_fd`` 301*4882a593Smuzhiyun - File descriptor of the request to be used by this operation. Only 302*4882a593Smuzhiyun valid if ``which`` is set to ``V4L2_CTRL_WHICH_REQUEST_VAL``. 303*4882a593Smuzhiyun If the device does not support requests, then ``EACCES`` will be returned. 304*4882a593Smuzhiyun If requests are supported but an invalid request file descriptor is 305*4882a593Smuzhiyun given, then ``EINVAL`` will be returned. 306*4882a593Smuzhiyun * - __u32 307*4882a593Smuzhiyun - ``reserved``\ [1] 308*4882a593Smuzhiyun - Reserved for future extensions. 309*4882a593Smuzhiyun 310*4882a593Smuzhiyun Drivers and applications must set the array to zero. 311*4882a593Smuzhiyun * - struct :c:type:`v4l2_ext_control` * 312*4882a593Smuzhiyun - ``controls`` 313*4882a593Smuzhiyun - Pointer to an array of ``count`` v4l2_ext_control structures. 314*4882a593Smuzhiyun 315*4882a593Smuzhiyun Ignored if ``count`` equals zero. 316*4882a593Smuzhiyun 317*4882a593Smuzhiyun.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| 318*4882a593Smuzhiyun 319*4882a593Smuzhiyun.. _ctrl-class: 320*4882a593Smuzhiyun 321*4882a593Smuzhiyun.. flat-table:: Control classes 322*4882a593Smuzhiyun :header-rows: 0 323*4882a593Smuzhiyun :stub-columns: 0 324*4882a593Smuzhiyun :widths: 3 1 4 325*4882a593Smuzhiyun 326*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_USER`` 327*4882a593Smuzhiyun - 0x980000 328*4882a593Smuzhiyun - The class containing user controls. These controls are described 329*4882a593Smuzhiyun in :ref:`control`. All controls that can be set using the 330*4882a593Smuzhiyun :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` and 331*4882a593Smuzhiyun :ref:`VIDIOC_G_CTRL <VIDIOC_G_CTRL>` ioctl belong to this 332*4882a593Smuzhiyun class. 333*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_MPEG`` 334*4882a593Smuzhiyun - 0x990000 335*4882a593Smuzhiyun - The class containing MPEG compression controls. These controls are 336*4882a593Smuzhiyun described in :ref:`mpeg-controls`. 337*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_CAMERA`` 338*4882a593Smuzhiyun - 0x9a0000 339*4882a593Smuzhiyun - The class containing camera controls. These controls are described 340*4882a593Smuzhiyun in :ref:`camera-controls`. 341*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_FM_TX`` 342*4882a593Smuzhiyun - 0x9b0000 343*4882a593Smuzhiyun - The class containing FM Transmitter (FM TX) controls. These 344*4882a593Smuzhiyun controls are described in :ref:`fm-tx-controls`. 345*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_FLASH`` 346*4882a593Smuzhiyun - 0x9c0000 347*4882a593Smuzhiyun - The class containing flash device controls. These controls are 348*4882a593Smuzhiyun described in :ref:`flash-controls`. 349*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_JPEG`` 350*4882a593Smuzhiyun - 0x9d0000 351*4882a593Smuzhiyun - The class containing JPEG compression controls. These controls are 352*4882a593Smuzhiyun described in :ref:`jpeg-controls`. 353*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_IMAGE_SOURCE`` 354*4882a593Smuzhiyun - 0x9e0000 355*4882a593Smuzhiyun - The class containing image source controls. These controls are 356*4882a593Smuzhiyun described in :ref:`image-source-controls`. 357*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_IMAGE_PROC`` 358*4882a593Smuzhiyun - 0x9f0000 359*4882a593Smuzhiyun - The class containing image processing controls. These controls are 360*4882a593Smuzhiyun described in :ref:`image-process-controls`. 361*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_FM_RX`` 362*4882a593Smuzhiyun - 0xa10000 363*4882a593Smuzhiyun - The class containing FM Receiver (FM RX) controls. These controls 364*4882a593Smuzhiyun are described in :ref:`fm-rx-controls`. 365*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_RF_TUNER`` 366*4882a593Smuzhiyun - 0xa20000 367*4882a593Smuzhiyun - The class containing RF tuner controls. These controls are 368*4882a593Smuzhiyun described in :ref:`rf-tuner-controls`. 369*4882a593Smuzhiyun * - ``V4L2_CTRL_CLASS_COLORIMETRY`` 370*4882a593Smuzhiyun - 0xa50000 371*4882a593Smuzhiyun - The class containing colorimetry controls. These controls are 372*4882a593Smuzhiyun described in :ref:`colorimetry-controls`. 373*4882a593Smuzhiyun 374*4882a593SmuzhiyunReturn Value 375*4882a593Smuzhiyun============ 376*4882a593Smuzhiyun 377*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set 378*4882a593Smuzhiyunappropriately. The generic error codes are described at the 379*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter. 380*4882a593Smuzhiyun 381*4882a593SmuzhiyunEINVAL 382*4882a593Smuzhiyun The struct :c:type:`v4l2_ext_control` ``id`` is 383*4882a593Smuzhiyun invalid, or the struct :c:type:`v4l2_ext_controls` 384*4882a593Smuzhiyun ``which`` is invalid, or the struct 385*4882a593Smuzhiyun :c:type:`v4l2_ext_control` ``value`` was 386*4882a593Smuzhiyun inappropriate (e.g. the given menu index is not supported by the 387*4882a593Smuzhiyun driver), or the ``which`` field was set to ``V4L2_CTRL_WHICH_REQUEST_VAL`` 388*4882a593Smuzhiyun but the given ``request_fd`` was invalid or ``V4L2_CTRL_WHICH_REQUEST_VAL`` 389*4882a593Smuzhiyun is not supported by the kernel. 390*4882a593Smuzhiyun This error code is also returned by the 391*4882a593Smuzhiyun :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` and :ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctls if two or 392*4882a593Smuzhiyun more control values are in conflict. 393*4882a593Smuzhiyun 394*4882a593SmuzhiyunERANGE 395*4882a593Smuzhiyun The struct :c:type:`v4l2_ext_control` ``value`` 396*4882a593Smuzhiyun is out of bounds. 397*4882a593Smuzhiyun 398*4882a593SmuzhiyunEBUSY 399*4882a593Smuzhiyun The control is temporarily not changeable, possibly because another 400*4882a593Smuzhiyun applications took over control of the device function this control 401*4882a593Smuzhiyun belongs to, or (if the ``which`` field was set to 402*4882a593Smuzhiyun ``V4L2_CTRL_WHICH_REQUEST_VAL``) the request was queued but not yet 403*4882a593Smuzhiyun completed. 404*4882a593Smuzhiyun 405*4882a593SmuzhiyunENOSPC 406*4882a593Smuzhiyun The space reserved for the control's payload is insufficient. The 407*4882a593Smuzhiyun field ``size`` is set to a value that is enough to store the payload 408*4882a593Smuzhiyun and this error code is returned. 409*4882a593Smuzhiyun 410*4882a593SmuzhiyunEACCES 411*4882a593Smuzhiyun Attempt to try or set a read-only control, or to get a write-only 412*4882a593Smuzhiyun control, or to get a control from a request that has not yet been 413*4882a593Smuzhiyun completed. 414*4882a593Smuzhiyun 415*4882a593Smuzhiyun Or the ``which`` field was set to ``V4L2_CTRL_WHICH_REQUEST_VAL`` but the 416*4882a593Smuzhiyun device does not support requests. 417