Markus Heiser | 5377d91 | 2016-06-30 15:18:56 +0200 | [diff] [blame^] | 1 | .. -*- coding: utf-8; mode: rst -*- |
| 2 | |
| 3 | .. _vidioc-queryctrl: |
| 4 | |
| 5 | *************************************************************** |
| 6 | ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU |
| 7 | *************************************************************** |
| 8 | |
| 9 | *man VIDIOC_QUERYCTRL(2)* |
| 10 | |
| 11 | VIDIOC_QUERY_EXT_CTRL |
| 12 | VIDIOC_QUERYMENU |
| 13 | Enumerate controls and menu control items |
| 14 | |
| 15 | |
| 16 | Synopsis |
| 17 | ======== |
| 18 | |
| 19 | .. c:function:: int ioctl( int fd, int request, struct v4l2_queryctrl *argp ) |
| 20 | |
| 21 | .. c:function:: int ioctl( int fd, int request, struct v4l2_query_ext_ctrl *argp ) |
| 22 | |
| 23 | .. c:function:: int ioctl( int fd, int request, struct v4l2_querymenu *argp ) |
| 24 | |
| 25 | Arguments |
| 26 | ========= |
| 27 | |
| 28 | ``fd`` |
| 29 | File descriptor returned by :ref:`open() <func-open>`. |
| 30 | |
| 31 | ``request`` |
| 32 | VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU |
| 33 | |
| 34 | ``argp`` |
| 35 | |
| 36 | |
| 37 | Description |
| 38 | =========== |
| 39 | |
| 40 | To query the attributes of a control applications set the ``id`` field |
| 41 | of a struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` and call the |
| 42 | ``VIDIOC_QUERYCTRL`` ioctl with a pointer to this structure. The driver |
| 43 | fills the rest of the structure or returns an EINVAL error code when the |
| 44 | ``id`` is invalid. |
| 45 | |
| 46 | It is possible to enumerate controls by calling ``VIDIOC_QUERYCTRL`` |
| 47 | with successive ``id`` values starting from ``V4L2_CID_BASE`` up to and |
| 48 | exclusive ``V4L2_CID_LASTP1``. Drivers may return EINVAL if a control in |
| 49 | this range is not supported. Further applications can enumerate private |
| 50 | controls, which are not defined in this specification, by starting at |
| 51 | ``V4L2_CID_PRIVATE_BASE`` and incrementing ``id`` until the driver |
| 52 | returns EINVAL. |
| 53 | |
| 54 | In both cases, when the driver sets the ``V4L2_CTRL_FLAG_DISABLED`` flag |
| 55 | in the ``flags`` field this control is permanently disabled and should |
| 56 | be ignored by the application. [1]_ |
| 57 | |
| 58 | When the application ORs ``id`` with ``V4L2_CTRL_FLAG_NEXT_CTRL`` the |
| 59 | driver returns the next supported non-compound control, or EINVAL if |
| 60 | there is none. In addition, the ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` flag |
| 61 | can be specified to enumerate all compound controls (i.e. controls with |
| 62 | type ≥ ``V4L2_CTRL_COMPOUND_TYPES`` and/or array control, in other words |
| 63 | controls that contain more than one value). Specify both |
| 64 | ``V4L2_CTRL_FLAG_NEXT_CTRL`` and ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` in |
| 65 | order to enumerate all controls, compound or not. Drivers which do not |
| 66 | support these flags yet always return EINVAL. |
| 67 | |
| 68 | The ``VIDIOC_QUERY_EXT_CTRL`` ioctl was introduced in order to better |
| 69 | support controls that can use compound types, and to expose additional |
| 70 | control information that cannot be returned in struct |
| 71 | :ref:`v4l2_queryctrl <v4l2-queryctrl>` since that structure is full. |
| 72 | |
| 73 | ``VIDIOC_QUERY_EXT_CTRL`` is used in the same way as |
| 74 | ``VIDIOC_QUERYCTRL``, except that the ``reserved`` array must be zeroed |
| 75 | as well. |
| 76 | |
| 77 | Additional information is required for menu controls: the names of the |
| 78 | menu items. To query them applications set the ``id`` and ``index`` |
| 79 | fields of struct :ref:`v4l2_querymenu <v4l2-querymenu>` and call the |
| 80 | ``VIDIOC_QUERYMENU`` ioctl with a pointer to this structure. The driver |
| 81 | fills the rest of the structure or returns an EINVAL error code when the |
| 82 | ``id`` or ``index`` is invalid. Menu items are enumerated by calling |
| 83 | ``VIDIOC_QUERYMENU`` with successive ``index`` values from struct |
| 84 | :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``minimum`` to ``maximum``, |
| 85 | inclusive. Note that it is possible for ``VIDIOC_QUERYMENU`` to return |
| 86 | an EINVAL error code for some indices between ``minimum`` and |
| 87 | ``maximum``. In that case that particular menu item is not supported by |
| 88 | this driver. Also note that the ``minimum`` value is not necessarily 0. |
| 89 | |
| 90 | See also the examples in :ref:`control`. |
| 91 | |
| 92 | |
| 93 | .. _v4l2-queryctrl: |
| 94 | |
| 95 | .. flat-table:: struct v4l2_queryctrl |
| 96 | :header-rows: 0 |
| 97 | :stub-columns: 0 |
| 98 | :widths: 1 1 2 |
| 99 | |
| 100 | |
| 101 | - .. row 1 |
| 102 | |
| 103 | - __u32 |
| 104 | |
| 105 | - ``id`` |
| 106 | |
| 107 | - Identifies the control, set by the application. See |
| 108 | :ref:`control-id` for predefined IDs. When the ID is ORed with |
| 109 | V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and |
| 110 | returns the first control with a higher ID. Drivers which do not |
| 111 | support this flag yet always return an EINVAL error code. |
| 112 | |
| 113 | - .. row 2 |
| 114 | |
| 115 | - __u32 |
| 116 | |
| 117 | - ``type`` |
| 118 | |
| 119 | - Type of control, see :ref:`v4l2-ctrl-type`. |
| 120 | |
| 121 | - .. row 3 |
| 122 | |
| 123 | - __u8 |
| 124 | |
| 125 | - ``name``\ [32] |
| 126 | |
| 127 | - Name of the control, a NUL-terminated ASCII string. This |
| 128 | information is intended for the user. |
| 129 | |
| 130 | - .. row 4 |
| 131 | |
| 132 | - __s32 |
| 133 | |
| 134 | - ``minimum`` |
| 135 | |
| 136 | - Minimum value, inclusive. This field gives a lower bound for the |
| 137 | control. See enum :ref:`v4l2_ctrl_type <v4l2-ctrl-type>` how |
| 138 | the minimum value is to be used for each possible control type. |
| 139 | Note that this a signed 32-bit value. |
| 140 | |
| 141 | - .. row 5 |
| 142 | |
| 143 | - __s32 |
| 144 | |
| 145 | - ``maximum`` |
| 146 | |
| 147 | - Maximum value, inclusive. This field gives an upper bound for the |
| 148 | control. See enum :ref:`v4l2_ctrl_type <v4l2-ctrl-type>` how |
| 149 | the maximum value is to be used for each possible control type. |
| 150 | Note that this a signed 32-bit value. |
| 151 | |
| 152 | - .. row 6 |
| 153 | |
| 154 | - __s32 |
| 155 | |
| 156 | - ``step`` |
| 157 | |
| 158 | - This field gives a step size for the control. See enum |
| 159 | :ref:`v4l2_ctrl_type <v4l2-ctrl-type>` how the step value is |
| 160 | to be used for each possible control type. Note that this an |
| 161 | unsigned 32-bit value. |
| 162 | |
| 163 | Generally drivers should not scale hardware control values. It may |
| 164 | be necessary for example when the ``name`` or ``id`` imply a |
| 165 | particular unit and the hardware actually accepts only multiples |
| 166 | of said unit. If so, drivers must take care values are properly |
| 167 | rounded when scaling, such that errors will not accumulate on |
| 168 | repeated read-write cycles. |
| 169 | |
| 170 | This field gives the smallest change of an integer control |
| 171 | actually affecting hardware. Often the information is needed when |
| 172 | the user can change controls by keyboard or GUI buttons, rather |
| 173 | than a slider. When for example a hardware register accepts values |
| 174 | 0-511 and the driver reports 0-65535, step should be 128. |
| 175 | |
| 176 | Note that although signed, the step value is supposed to be always |
| 177 | positive. |
| 178 | |
| 179 | - .. row 7 |
| 180 | |
| 181 | - __s32 |
| 182 | |
| 183 | - ``default_value`` |
| 184 | |
| 185 | - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_BOOLEAN``, |
| 186 | ``_BITMASK``, ``_MENU`` or ``_INTEGER_MENU`` control. Not valid |
| 187 | for other types of controls. Note that drivers reset controls to |
| 188 | their default value only when the driver is first loaded, never |
| 189 | afterwards. |
| 190 | |
| 191 | - .. row 8 |
| 192 | |
| 193 | - __u32 |
| 194 | |
| 195 | - ``flags`` |
| 196 | |
| 197 | - Control flags, see :ref:`control-flags`. |
| 198 | |
| 199 | - .. row 9 |
| 200 | |
| 201 | - __u32 |
| 202 | |
| 203 | - ``reserved``\ [2] |
| 204 | |
| 205 | - Reserved for future extensions. Drivers must set the array to |
| 206 | zero. |
| 207 | |
| 208 | |
| 209 | |
| 210 | .. _v4l2-query-ext-ctrl: |
| 211 | |
| 212 | .. flat-table:: struct v4l2_query_ext_ctrl |
| 213 | :header-rows: 0 |
| 214 | :stub-columns: 0 |
| 215 | :widths: 1 1 2 |
| 216 | |
| 217 | |
| 218 | - .. row 1 |
| 219 | |
| 220 | - __u32 |
| 221 | |
| 222 | - ``id`` |
| 223 | |
| 224 | - Identifies the control, set by the application. See |
| 225 | :ref:`control-id` for predefined IDs. When the ID is ORed with |
| 226 | ``V4L2_CTRL_FLAG_NEXT_CTRL`` the driver clears the flag and |
| 227 | returns the first non-compound control with a higher ID. When the |
| 228 | ID is ORed with ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` the driver clears |
| 229 | the flag and returns the first compound control with a higher ID. |
| 230 | Set both to get the first control (compound or not) with a higher |
| 231 | ID. |
| 232 | |
| 233 | - .. row 2 |
| 234 | |
| 235 | - __u32 |
| 236 | |
| 237 | - ``type`` |
| 238 | |
| 239 | - Type of control, see :ref:`v4l2-ctrl-type`. |
| 240 | |
| 241 | - .. row 3 |
| 242 | |
| 243 | - char |
| 244 | |
| 245 | - ``name``\ [32] |
| 246 | |
| 247 | - Name of the control, a NUL-terminated ASCII string. This |
| 248 | information is intended for the user. |
| 249 | |
| 250 | - .. row 4 |
| 251 | |
| 252 | - __s64 |
| 253 | |
| 254 | - ``minimum`` |
| 255 | |
| 256 | - Minimum value, inclusive. This field gives a lower bound for the |
| 257 | control. See enum :ref:`v4l2_ctrl_type <v4l2-ctrl-type>` how |
| 258 | the minimum value is to be used for each possible control type. |
| 259 | Note that this a signed 64-bit value. |
| 260 | |
| 261 | - .. row 5 |
| 262 | |
| 263 | - __s64 |
| 264 | |
| 265 | - ``maximum`` |
| 266 | |
| 267 | - Maximum value, inclusive. This field gives an upper bound for the |
| 268 | control. See enum :ref:`v4l2_ctrl_type <v4l2-ctrl-type>` how |
| 269 | the maximum value is to be used for each possible control type. |
| 270 | Note that this a signed 64-bit value. |
| 271 | |
| 272 | - .. row 6 |
| 273 | |
| 274 | - __u64 |
| 275 | |
| 276 | - ``step`` |
| 277 | |
| 278 | - This field gives a step size for the control. See enum |
| 279 | :ref:`v4l2_ctrl_type <v4l2-ctrl-type>` how the step value is |
| 280 | to be used for each possible control type. Note that this an |
| 281 | unsigned 64-bit value. |
| 282 | |
| 283 | Generally drivers should not scale hardware control values. It may |
| 284 | be necessary for example when the ``name`` or ``id`` imply a |
| 285 | particular unit and the hardware actually accepts only multiples |
| 286 | of said unit. If so, drivers must take care values are properly |
| 287 | rounded when scaling, such that errors will not accumulate on |
| 288 | repeated read-write cycles. |
| 289 | |
| 290 | This field gives the smallest change of an integer control |
| 291 | actually affecting hardware. Often the information is needed when |
| 292 | the user can change controls by keyboard or GUI buttons, rather |
| 293 | than a slider. When for example a hardware register accepts values |
| 294 | 0-511 and the driver reports 0-65535, step should be 128. |
| 295 | |
| 296 | - .. row 7 |
| 297 | |
| 298 | - __s64 |
| 299 | |
| 300 | - ``default_value`` |
| 301 | |
| 302 | - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_INTEGER64``, |
| 303 | ``_BOOLEAN``, ``_BITMASK``, ``_MENU``, ``_INTEGER_MENU``, ``_U8`` |
| 304 | or ``_U16`` control. Not valid for other types of controls. Note |
| 305 | that drivers reset controls to their default value only when the |
| 306 | driver is first loaded, never afterwards. |
| 307 | |
| 308 | - .. row 8 |
| 309 | |
| 310 | - __u32 |
| 311 | |
| 312 | - ``flags`` |
| 313 | |
| 314 | - Control flags, see :ref:`control-flags`. |
| 315 | |
| 316 | - .. row 9 |
| 317 | |
| 318 | - __u32 |
| 319 | |
| 320 | - ``elem_size`` |
| 321 | |
| 322 | - The size in bytes of a single element of the array. Given a char |
| 323 | pointer ``p`` to a 3-dimensional array you can find the position |
| 324 | of cell ``(z, y, x)`` as follows: |
| 325 | ``p + ((z * dims[1] + y) * dims[0] + x) * elem_size``. |
| 326 | ``elem_size`` is always valid, also when the control isn't an |
| 327 | array. For string controls ``elem_size`` is equal to |
| 328 | ``maximum + 1``. |
| 329 | |
| 330 | - .. row 10 |
| 331 | |
| 332 | - __u32 |
| 333 | |
| 334 | - ``elems`` |
| 335 | |
| 336 | - The number of elements in the N-dimensional array. If this control |
| 337 | is not an array, then ``elems`` is 1. The ``elems`` field can |
| 338 | never be 0. |
| 339 | |
| 340 | - .. row 11 |
| 341 | |
| 342 | - __u32 |
| 343 | |
| 344 | - ``nr_of_dims`` |
| 345 | |
| 346 | - The number of dimension in the N-dimensional array. If this |
| 347 | control is not an array, then this field is 0. |
| 348 | |
| 349 | - .. row 12 |
| 350 | |
| 351 | - __u32 |
| 352 | |
| 353 | - ``dims[V4L2_CTRL_MAX_DIMS]`` |
| 354 | |
| 355 | - The size of each dimension. The first ``nr_of_dims`` elements of |
| 356 | this array must be non-zero, all remaining elements must be zero. |
| 357 | |
| 358 | - .. row 13 |
| 359 | |
| 360 | - __u32 |
| 361 | |
| 362 | - ``reserved``\ [32] |
| 363 | |
| 364 | - Reserved for future extensions. Applications and drivers must set |
| 365 | the array to zero. |
| 366 | |
| 367 | |
| 368 | |
| 369 | .. _v4l2-querymenu: |
| 370 | |
| 371 | .. flat-table:: struct v4l2_querymenu |
| 372 | :header-rows: 0 |
| 373 | :stub-columns: 0 |
| 374 | :widths: 1 1 2 1 |
| 375 | |
| 376 | |
| 377 | - .. row 1 |
| 378 | |
| 379 | - __u32 |
| 380 | |
| 381 | - |
| 382 | - ``id`` |
| 383 | |
| 384 | - Identifies the control, set by the application from the respective |
| 385 | struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``id``. |
| 386 | |
| 387 | - .. row 2 |
| 388 | |
| 389 | - __u32 |
| 390 | |
| 391 | - |
| 392 | - ``index`` |
| 393 | |
| 394 | - Index of the menu item, starting at zero, set by the application. |
| 395 | |
| 396 | - .. row 3 |
| 397 | |
| 398 | - union |
| 399 | |
| 400 | - |
| 401 | - |
| 402 | - |
| 403 | |
| 404 | - .. row 4 |
| 405 | |
| 406 | - |
| 407 | - __u8 |
| 408 | |
| 409 | - ``name``\ [32] |
| 410 | |
| 411 | - Name of the menu item, a NUL-terminated ASCII string. This |
| 412 | information is intended for the user. This field is valid for |
| 413 | ``V4L2_CTRL_FLAG_MENU`` type controls. |
| 414 | |
| 415 | - .. row 5 |
| 416 | |
| 417 | - |
| 418 | - __s64 |
| 419 | |
| 420 | - ``value`` |
| 421 | |
| 422 | - Value of the integer menu item. This field is valid for |
| 423 | ``V4L2_CTRL_FLAG_INTEGER_MENU`` type controls. |
| 424 | |
| 425 | - .. row 6 |
| 426 | |
| 427 | - __u32 |
| 428 | |
| 429 | - |
| 430 | - ``reserved`` |
| 431 | |
| 432 | - Reserved for future extensions. Drivers must set the array to |
| 433 | zero. |
| 434 | |
| 435 | |
| 436 | |
| 437 | .. _v4l2-ctrl-type: |
| 438 | |
| 439 | .. flat-table:: enum v4l2_ctrl_type |
| 440 | :header-rows: 1 |
| 441 | :stub-columns: 0 |
| 442 | :widths: 30 5 5 5 55 |
| 443 | |
| 444 | |
| 445 | - .. row 1 |
| 446 | |
| 447 | - Type |
| 448 | |
| 449 | - ``minimum`` |
| 450 | |
| 451 | - ``step`` |
| 452 | |
| 453 | - ``maximum`` |
| 454 | |
| 455 | - Description |
| 456 | |
| 457 | - .. row 2 |
| 458 | |
| 459 | - ``V4L2_CTRL_TYPE_INTEGER`` |
| 460 | |
| 461 | - any |
| 462 | |
| 463 | - any |
| 464 | |
| 465 | - any |
| 466 | |
| 467 | - An integer-valued control ranging from minimum to maximum |
| 468 | inclusive. The step value indicates the increment between values. |
| 469 | |
| 470 | - .. row 3 |
| 471 | |
| 472 | - ``V4L2_CTRL_TYPE_BOOLEAN`` |
| 473 | |
| 474 | - 0 |
| 475 | |
| 476 | - 1 |
| 477 | |
| 478 | - 1 |
| 479 | |
| 480 | - A boolean-valued control. Zero corresponds to "disabled", and one |
| 481 | means "enabled". |
| 482 | |
| 483 | - .. row 4 |
| 484 | |
| 485 | - ``V4L2_CTRL_TYPE_MENU`` |
| 486 | |
| 487 | - ≥ 0 |
| 488 | |
| 489 | - 1 |
| 490 | |
| 491 | - N-1 |
| 492 | |
| 493 | - The control has a menu of N choices. The names of the menu items |
| 494 | can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl. |
| 495 | |
| 496 | - .. row 5 |
| 497 | |
| 498 | - ``V4L2_CTRL_TYPE_INTEGER_MENU`` |
| 499 | |
| 500 | - ≥ 0 |
| 501 | |
| 502 | - 1 |
| 503 | |
| 504 | - N-1 |
| 505 | |
| 506 | - The control has a menu of N choices. The values of the menu items |
| 507 | can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl. This is |
| 508 | similar to ``V4L2_CTRL_TYPE_MENU`` except that instead of strings, |
| 509 | the menu items are signed 64-bit integers. |
| 510 | |
| 511 | - .. row 6 |
| 512 | |
| 513 | - ``V4L2_CTRL_TYPE_BITMASK`` |
| 514 | |
| 515 | - 0 |
| 516 | |
| 517 | - n/a |
| 518 | |
| 519 | - any |
| 520 | |
| 521 | - A bitmask field. The maximum value is the set of bits that can be |
| 522 | used, all other bits are to be 0. The maximum value is interpreted |
| 523 | as a __u32, allowing the use of bit 31 in the bitmask. |
| 524 | |
| 525 | - .. row 7 |
| 526 | |
| 527 | - ``V4L2_CTRL_TYPE_BUTTON`` |
| 528 | |
| 529 | - 0 |
| 530 | |
| 531 | - 0 |
| 532 | |
| 533 | - 0 |
| 534 | |
| 535 | - A control which performs an action when set. Drivers must ignore |
| 536 | the value passed with ``VIDIOC_S_CTRL`` and return an EINVAL error |
| 537 | code on a ``VIDIOC_G_CTRL`` attempt. |
| 538 | |
| 539 | - .. row 8 |
| 540 | |
| 541 | - ``V4L2_CTRL_TYPE_INTEGER64`` |
| 542 | |
| 543 | - any |
| 544 | |
| 545 | - any |
| 546 | |
| 547 | - any |
| 548 | |
| 549 | - A 64-bit integer valued control. Minimum, maximum and step size |
| 550 | cannot be queried using ``VIDIOC_QUERYCTRL``. Only |
| 551 | ``VIDIOC_QUERY_EXT_CTRL`` can retrieve the 64-bit min/max/step |
| 552 | values, they should be interpreted as n/a when using |
| 553 | ``VIDIOC_QUERYCTRL``. |
| 554 | |
| 555 | - .. row 9 |
| 556 | |
| 557 | - ``V4L2_CTRL_TYPE_STRING`` |
| 558 | |
| 559 | - ≥ 0 |
| 560 | |
| 561 | - ≥ 1 |
| 562 | |
| 563 | - ≥ 0 |
| 564 | |
| 565 | - The minimum and maximum string lengths. The step size means that |
| 566 | the string must be (minimum + N * step) characters long for N ≥ 0. |
| 567 | These lengths do not include the terminating zero, so in order to |
| 568 | pass a string of length 8 to |
| 569 | :ref:`VIDIOC_S_EXT_CTRLS <vidioc-g-ext-ctrls>` you need to |
| 570 | set the ``size`` field of struct |
| 571 | :ref:`v4l2_ext_control <v4l2-ext-control>` to 9. For |
| 572 | :ref:`VIDIOC_G_EXT_CTRLS <vidioc-g-ext-ctrls>` you can set |
| 573 | the ``size`` field to ``maximum`` + 1. Which character encoding is |
| 574 | used will depend on the string control itself and should be part |
| 575 | of the control documentation. |
| 576 | |
| 577 | - .. row 10 |
| 578 | |
| 579 | - ``V4L2_CTRL_TYPE_CTRL_CLASS`` |
| 580 | |
| 581 | - n/a |
| 582 | |
| 583 | - n/a |
| 584 | |
| 585 | - n/a |
| 586 | |
| 587 | - This is not a control. When ``VIDIOC_QUERYCTRL`` is called with a |
| 588 | control ID equal to a control class code (see :ref:`ctrl-class`) |
| 589 | + 1, the ioctl returns the name of the control class and this |
| 590 | control type. Older drivers which do not support this feature |
| 591 | return an EINVAL error code. |
| 592 | |
| 593 | - .. row 11 |
| 594 | |
| 595 | - ``V4L2_CTRL_TYPE_U8`` |
| 596 | |
| 597 | - any |
| 598 | |
| 599 | - any |
| 600 | |
| 601 | - any |
| 602 | |
| 603 | - An unsigned 8-bit valued control ranging from minimum to maximum |
| 604 | inclusive. The step value indicates the increment between values. |
| 605 | |
| 606 | - .. row 12 |
| 607 | |
| 608 | - ``V4L2_CTRL_TYPE_U16`` |
| 609 | |
| 610 | - any |
| 611 | |
| 612 | - any |
| 613 | |
| 614 | - any |
| 615 | |
| 616 | - An unsigned 16-bit valued control ranging from minimum to maximum |
| 617 | inclusive. The step value indicates the increment between values. |
| 618 | |
| 619 | - .. row 13 |
| 620 | |
| 621 | - ``V4L2_CTRL_TYPE_U32`` |
| 622 | |
| 623 | - any |
| 624 | |
| 625 | - any |
| 626 | |
| 627 | - any |
| 628 | |
| 629 | - An unsigned 32-bit valued control ranging from minimum to maximum |
| 630 | inclusive. The step value indicates the increment between values. |
| 631 | |
| 632 | |
| 633 | |
| 634 | .. _control-flags: |
| 635 | |
| 636 | .. flat-table:: Control Flags |
| 637 | :header-rows: 0 |
| 638 | :stub-columns: 0 |
| 639 | :widths: 3 1 4 |
| 640 | |
| 641 | |
| 642 | - .. row 1 |
| 643 | |
| 644 | - ``V4L2_CTRL_FLAG_DISABLED`` |
| 645 | |
| 646 | - 0x0001 |
| 647 | |
| 648 | - This control is permanently disabled and should be ignored by the |
| 649 | application. Any attempt to change the control will result in an |
| 650 | EINVAL error code. |
| 651 | |
| 652 | - .. row 2 |
| 653 | |
| 654 | - ``V4L2_CTRL_FLAG_GRABBED`` |
| 655 | |
| 656 | - 0x0002 |
| 657 | |
| 658 | - This control is temporarily unchangeable, for example because |
| 659 | another application took over control of the respective resource. |
| 660 | Such controls may be displayed specially in a user interface. |
| 661 | Attempts to change the control may result in an EBUSY error code. |
| 662 | |
| 663 | - .. row 3 |
| 664 | |
| 665 | - ``V4L2_CTRL_FLAG_READ_ONLY`` |
| 666 | |
| 667 | - 0x0004 |
| 668 | |
| 669 | - This control is permanently readable only. Any attempt to change |
| 670 | the control will result in an EINVAL error code. |
| 671 | |
| 672 | - .. row 4 |
| 673 | |
| 674 | - ``V4L2_CTRL_FLAG_UPDATE`` |
| 675 | |
| 676 | - 0x0008 |
| 677 | |
| 678 | - A hint that changing this control may affect the value of other |
| 679 | controls within the same control class. Applications should update |
| 680 | their user interface accordingly. |
| 681 | |
| 682 | - .. row 5 |
| 683 | |
| 684 | - ``V4L2_CTRL_FLAG_INACTIVE`` |
| 685 | |
| 686 | - 0x0010 |
| 687 | |
| 688 | - This control is not applicable to the current configuration and |
| 689 | should be displayed accordingly in a user interface. For example |
| 690 | the flag may be set on a MPEG audio level 2 bitrate control when |
| 691 | MPEG audio encoding level 1 was selected with another control. |
| 692 | |
| 693 | - .. row 6 |
| 694 | |
| 695 | - ``V4L2_CTRL_FLAG_SLIDER`` |
| 696 | |
| 697 | - 0x0020 |
| 698 | |
| 699 | - A hint that this control is best represented as a slider-like |
| 700 | element in a user interface. |
| 701 | |
| 702 | - .. row 7 |
| 703 | |
| 704 | - ``V4L2_CTRL_FLAG_WRITE_ONLY`` |
| 705 | |
| 706 | - 0x0040 |
| 707 | |
| 708 | - This control is permanently writable only. Any attempt to read the |
| 709 | control will result in an EACCES error code error code. This flag |
| 710 | is typically present for relative controls or action controls |
| 711 | where writing a value will cause the device to carry out a given |
| 712 | action (e. g. motor control) but no meaningful value can be |
| 713 | returned. |
| 714 | |
| 715 | - .. row 8 |
| 716 | |
| 717 | - ``V4L2_CTRL_FLAG_VOLATILE`` |
| 718 | |
| 719 | - 0x0080 |
| 720 | |
| 721 | - This control is volatile, which means that the value of the |
| 722 | control changes continuously. A typical example would be the |
| 723 | current gain value if the device is in auto-gain mode. In such a |
| 724 | case the hardware calculates the gain value based on the lighting |
| 725 | conditions which can change over time. Note that setting a new |
| 726 | value for a volatile control will have no effect and no |
| 727 | ``V4L2_EVENT_CTRL_CH_VALUE`` will be sent, unless the |
| 728 | ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`` flag (see below) is also set. |
| 729 | Otherwise the new value will just be ignored. |
| 730 | |
| 731 | - .. row 9 |
| 732 | |
| 733 | - ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` |
| 734 | |
| 735 | - 0x0100 |
| 736 | |
| 737 | - This control has a pointer type, so its value has to be accessed |
| 738 | using one of the pointer fields of struct |
| 739 | :ref:`v4l2_ext_control <v4l2-ext-control>`. This flag is set |
| 740 | for controls that are an array, string, or have a compound type. |
| 741 | In all cases you have to set a pointer to memory containing the |
| 742 | payload of the control. |
| 743 | |
| 744 | - .. row 10 |
| 745 | |
| 746 | - ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`` |
| 747 | |
| 748 | - 0x0200 |
| 749 | |
| 750 | - The value provided to the control will be propagated to the driver |
| 751 | even if it remains constant. This is required when the control |
| 752 | represents an action on the hardware. For example: clearing an |
| 753 | error flag or triggering the flash. All the controls of the type |
| 754 | ``V4L2_CTRL_TYPE_BUTTON`` have this flag set. |
| 755 | |
| 756 | |
| 757 | |
| 758 | Return Value |
| 759 | ============ |
| 760 | |
| 761 | On success 0 is returned, on error -1 and the ``errno`` variable is set |
| 762 | appropriately. The generic error codes are described at the |
| 763 | :ref:`Generic Error Codes <gen-errors>` chapter. |
| 764 | |
| 765 | EINVAL |
| 766 | The struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``id`` is |
| 767 | invalid. The struct :ref:`v4l2_querymenu <v4l2-querymenu>` ``id`` |
| 768 | is invalid or ``index`` is out of range (less than ``minimum`` or |
| 769 | greater than ``maximum``) or this particular menu item is not |
| 770 | supported by the driver. |
| 771 | |
| 772 | EACCES |
| 773 | An attempt was made to read a write-only control. |
| 774 | |
| 775 | .. [1] |
| 776 | ``V4L2_CTRL_FLAG_DISABLED`` was intended for two purposes: Drivers |
| 777 | can skip predefined controls not supported by the hardware (although |
| 778 | returning EINVAL would do as well), or disable predefined and private |
| 779 | controls after hardware detection without the trouble of reordering |
| 780 | control arrays and indices (EINVAL cannot be used to skip private |
| 781 | controls because it would prematurely end the enumeration). |
| 782 | |
| 783 | |
| 784 | .. ------------------------------------------------------------------------------ |
| 785 | .. This file was automatically converted from DocBook-XML with the dbxml |
| 786 | .. library (https://github.com/return42/sphkerneldoc). The origin XML comes |
| 787 | .. from the linux kernel, refer to: |
| 788 | .. |
| 789 | .. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook |
| 790 | .. ------------------------------------------------------------------------------ |