← Documents Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst GitHub 원문 ↗

Linux 6.18.37 · 사용자 공간 API

VIDIOC_QUERYCTRL·VIDIOC_QUERY_EXT_CTRL·VIDIOC_QUERYMENU ioctl

V4L2 control과 menu 항목을 열거하고 기본·확장 query 구조체, scalar·array·codec compound type, 접근·payload·layout flag를 해석하는 방법을 설명합니다.

Source pathDocumentation/userspace-api/media/v4l/vidioc-queryctrl.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

vidioc-queryctrl.rst:1-698

NEXT flag 조합으로 control 종류를 빠짐없이 열거하고, compound·array payload와 접근 flag에 맞는 구조체·memory 경로를 선택해야 합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_QUERYCTRL:
5
6 *******************************************************************
7 ioctls VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL and VIDIOC_QUERYMENU
8 *******************************************************************
9
10 Name
11 ====
12
13 VIDIOC_QUERYCTRL - VIDIOC_QUERY_EXT_CTRL - VIDIOC_QUERYMENU - Enumerate controls and menu control items
14
15 Synopsis
16 ========
17
18 ``int ioctl(int fd, int VIDIOC_QUERYCTRL, struct v4l2_queryctrl *argp)``
19
20 .. c:macro:: VIDIOC_QUERY_EXT_CTRL
21
22 ``int ioctl(int fd, VIDIOC_QUERY_EXT_CTRL, struct v4l2_query_ext_ctrl *argp)``
23
24 .. c:macro:: VIDIOC_QUERYMENU
25
26 ``int ioctl(int fd, VIDIOC_QUERYMENU, struct v4l2_querymenu *argp)``
27
28 Arguments
29 =========
30
31 ``fd``
32 File descriptor returned by :c:func:`open()`.
33
34 ``argp``
35 Pointer to struct :c:type:`v4l2_queryctrl`, :c:type:`v4l2_query_ext_ctrl`
36 or :c:type:`v4l2_querymenu` (depending on the ioctl).
37
38 Description
39 ===========
40
41 To query the attributes of a control applications set the ``id`` field
42 of a struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` and call the
43 ``VIDIOC_QUERYCTRL`` ioctl with a pointer to this structure. The driver
44 fills the rest of the structure or returns an ``EINVAL`` error code when the
45 ``id`` is invalid.
46
47 It is possible to enumerate controls by calling ``VIDIOC_QUERYCTRL``
48 with successive ``id`` values starting from ``V4L2_CID_BASE`` up to and
49 exclusive ``V4L2_CID_LASTP1``. Drivers may return ``EINVAL`` if a control in
50 this range is not supported. Further applications can enumerate private
51 controls, which are not defined in this specification, by starting at
52 ``V4L2_CID_PRIVATE_BASE`` and incrementing ``id`` until the driver
53 returns ``EINVAL``.
54
55 In both cases, when the driver sets the ``V4L2_CTRL_FLAG_DISABLED`` flag
56 in the ``flags`` field this control is permanently disabled and should
57 be ignored by the application. [#f1]_
58
59 When the application ORs ``id`` with ``V4L2_CTRL_FLAG_NEXT_CTRL`` the
60 driver returns the next supported non-compound control, or ``EINVAL`` if
61 there is none. In addition, the ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` flag
62 can be specified to enumerate all compound controls (i.e. controls with
63 type ≥ ``V4L2_CTRL_COMPOUND_TYPES`` and/or array control, in other words
64 controls that contain more than one value). Specify both
65 ``V4L2_CTRL_FLAG_NEXT_CTRL`` and ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` in
66 order to enumerate all controls, compound or not. Drivers which do not
67 support these flags yet always return ``EINVAL``.
68
69 The ``VIDIOC_QUERY_EXT_CTRL`` ioctl was introduced in order to better
70 support controls that can use compound types, and to expose additional
71 control information that cannot be returned in struct
72 :ref:`v4l2_queryctrl <v4l2-queryctrl>` since that structure is full.
73
74 ``VIDIOC_QUERY_EXT_CTRL`` is used in the same way as
75 ``VIDIOC_QUERYCTRL``, except that the ``reserved`` array must be zeroed
76 as well.
77
78 Additional information is required for menu controls: the names of the
79 menu items. To query them applications set the ``id`` and ``index``
80 fields of struct :ref:`v4l2_querymenu <v4l2-querymenu>` and call the
81 ``VIDIOC_QUERYMENU`` ioctl with a pointer to this structure. The driver
82 fills the rest of the structure or returns an ``EINVAL`` error code when the
83 ``id`` or ``index`` is invalid. Menu items are enumerated by calling
84 ``VIDIOC_QUERYMENU`` with successive ``index`` values from struct
85 :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``minimum`` to ``maximum``,
86 inclusive.
87
88 .. note::
89
90 It is possible for ``VIDIOC_QUERYMENU`` to return
91 an ``EINVAL`` error code for some indices between ``minimum`` and
92 ``maximum``. In that case that particular menu item is not supported by
93 this driver. Also note that the ``minimum`` value is not necessarily 0.
94
95 See also the examples in :ref:`control`.
96
97 .. tabularcolumns:: |p{1.2cm}|p{3.6cm}|p{12.5cm}|
98
99 .. _v4l2-queryctrl:
100
101 .. cssclass:: longtable
102
103 .. flat-table:: struct v4l2_queryctrl
104 :header-rows: 0
105 :stub-columns: 0
106 :widths: 1 1 2
107
108 * - __u32
109 - ``id``
110 - Identifies the control, set by the application. See
111 :ref:`control-id` for predefined IDs. When the ID is ORed with
112 V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and
113 returns the first control with a higher ID. Drivers which do not
114 support this flag yet always return an ``EINVAL`` error code.
115 * - __u32
116 - ``type``
117 - Type of control, see :c:type:`v4l2_ctrl_type`.
118 * - __u8
119 - ``name``\ [32]
120 - Name of the control, a NUL-terminated ASCII string. This
121 information is intended for the user.
122 * - __s32
123 - ``minimum``
124 - Minimum value, inclusive. This field gives a lower bound for the
125 control. See enum :c:type:`v4l2_ctrl_type` how
126 the minimum value is to be used for each possible control type.
127 Note that this a signed 32-bit value.
128 * - __s32
129 - ``maximum``
130 - Maximum value, inclusive. This field gives an upper bound for the
131 control. See enum :c:type:`v4l2_ctrl_type` how
132 the maximum value is to be used for each possible control type.
133 Note that this a signed 32-bit value.
134 * - __s32
135 - ``step``
136 - This field gives a step size for the control. See enum
137 :c:type:`v4l2_ctrl_type` how the step value is
138 to be used for each possible control type. Note that this an
139 unsigned 32-bit value.
140
141 Generally drivers should not scale hardware control values. It may
142 be necessary for example when the ``name`` or ``id`` imply a
143 particular unit and the hardware actually accepts only multiples
144 of said unit. If so, drivers must take care values are properly
145 rounded when scaling, such that errors will not accumulate on
146 repeated read-write cycles.
147
148 This field gives the smallest change of an integer control
149 actually affecting hardware. Often the information is needed when
150 the user can change controls by keyboard or GUI buttons, rather
151 than a slider. When for example a hardware register accepts values
152 0-511 and the driver reports 0-65535, step should be 128.
153
154 Note that although signed, the step value is supposed to be always
155 positive.
156 * - __s32
157 - ``default_value``
158 - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_BOOLEAN``,
159 ``_BITMASK``, ``_MENU`` or ``_INTEGER_MENU`` control. Not valid
160 for other types of controls.
161
162 .. note::
163
164 Drivers reset controls to their default value only when
165 the driver is first loaded, never afterwards.
166 * - __u32
167 - ``flags``
168 - Control flags, see :ref:`control-flags`.
169 * - __u32
170 - ``reserved``\ [2]
171 - Reserved for future extensions. Drivers must set the array to
172 zero.
173
174
175 .. tabularcolumns:: |p{1.2cm}|p{5.5cm}|p{10.6cm}|
176
177 .. _v4l2-query-ext-ctrl:
178
179 .. cssclass:: longtable
180
181 .. flat-table:: struct v4l2_query_ext_ctrl
182 :header-rows: 0
183 :stub-columns: 0
184 :widths: 1 1 2
185
186 * - __u32
187 - ``id``
188 - Identifies the control, set by the application. See
189 :ref:`control-id` for predefined IDs. When the ID is ORed with
190 ``V4L2_CTRL_FLAG_NEXT_CTRL`` the driver clears the flag and
191 returns the first non-compound control with a higher ID. When the
192 ID is ORed with ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` the driver clears
193 the flag and returns the first compound control with a higher ID.
194 Set both to get the first control (compound or not) with a higher
195 ID.
196 * - __u32
197 - ``type``
198 - Type of control, see :c:type:`v4l2_ctrl_type`.
199 * - char
200 - ``name``\ [32]
201 - Name of the control, a NUL-terminated ASCII string. This
202 information is intended for the user.
203 * - __s64
204 - ``minimum``
205 - Minimum value, inclusive. This field gives a lower bound for the
206 control. See enum :c:type:`v4l2_ctrl_type` how
207 the minimum value is to be used for each possible control type.
208 Note that this a signed 64-bit value.
209 * - __s64
210 - ``maximum``
211 - Maximum value, inclusive. This field gives an upper bound for the
212 control. See enum :c:type:`v4l2_ctrl_type` how
213 the maximum value is to be used for each possible control type.
214 Note that this a signed 64-bit value.
215 * - __u64
216 - ``step``
217 - This field gives a step size for the control. See enum
218 :c:type:`v4l2_ctrl_type` how the step value is
219 to be used for each possible control type. Note that this an
220 unsigned 64-bit value.
221
222 Generally drivers should not scale hardware control values. It may
223 be necessary for example when the ``name`` or ``id`` imply a
224 particular unit and the hardware actually accepts only multiples
225 of said unit. If so, drivers must take care values are properly
226 rounded when scaling, such that errors will not accumulate on
227 repeated read-write cycles.
228
229 This field gives the smallest change of an integer control
230 actually affecting hardware. Often the information is needed when
231 the user can change controls by keyboard or GUI buttons, rather
232 than a slider. When for example a hardware register accepts values
233 0-511 and the driver reports 0-65535, step should be 128.
234 * - __s64
235 - ``default_value``
236 - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_INTEGER64``,
237 ``_BOOLEAN``, ``_BITMASK``, ``_MENU``, ``_INTEGER_MENU``, ``_U8``
238 or ``_U16`` control. Not valid for other types of controls.
239
240 .. note::
241
242 Drivers reset controls to their default value only when
243 the driver is first loaded, never afterwards.
244 * - __u32
245 - ``flags``
246 - Control flags, see :ref:`control-flags`.
247 * - __u32
248 - ``elem_size``
249 - The size in bytes of a single element of the array. Given a char
250 pointer ``p`` to a 3-dimensional array you can find the position
251 of cell ``(z, y, x)`` as follows:
252 ``p + ((z * dims[1] + y) * dims[0] + x) * elem_size``.
253 ``elem_size`` is always valid, also when the control isn't an
254 array. For string controls ``elem_size`` is equal to
255 ``maximum + 1``.
256 * - __u32
257 - ``elems``
258 - The number of elements in the N-dimensional array. If this control
259 is not an array, then ``elems`` is 1. The ``elems`` field can
260 never be 0.
261 * - __u32
262 - ``nr_of_dims``
263 - The number of dimension in the N-dimensional array. If this
264 control is not an array, then this field is 0.
265 * - __u32
266 - ``dims[V4L2_CTRL_MAX_DIMS]``
267 - The size of each dimension. The first ``nr_of_dims`` elements of
268 this array must be non-zero, all remaining elements must be zero.
269 * - __u32
270 - ``reserved``\ [32]
271 - Reserved for future extensions. Applications and drivers must set
272 the array to zero.
273
274
275 .. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{13.1cm}|
276
277 .. _v4l2-querymenu:
278
279 .. flat-table:: struct v4l2_querymenu
280 :header-rows: 0
281 :stub-columns: 0
282 :widths: 1 1 2
283
284 * - __u32
285 - ``id``
286 - Identifies the control, set by the application from the respective
287 struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``id``.
288 * - __u32
289 - ``index``
290 - Index of the menu item, starting at zero, set by the application.
291 * - union {
292 - (anonymous)
293 * - __u8
294 - ``name``\ [32]
295 - Name of the menu item, a NUL-terminated ASCII string. This
296 information is intended for the user. This field is valid for
297 ``V4L2_CTRL_TYPE_MENU`` type controls.
298 * - __s64
299 - ``value``
300 - Value of the integer menu item. This field is valid for
301 ``V4L2_CTRL_TYPE_INTEGER_MENU`` type controls.
302 * - }
303 -
304 * - __u32
305 - ``reserved``
306 - Reserved for future extensions. Drivers must set the array to
307 zero.
308
309 .. c:type:: v4l2_ctrl_type
310
311 .. raw:: latex
312
313 \footnotesize
314
315 .. tabularcolumns:: |p{6.5cm}|p{1.5cm}|p{1.1cm}|p{1.5cm}|p{6.8cm}|
316
317 .. cssclass:: longtable
318
319 .. flat-table:: enum v4l2_ctrl_type
320 :header-rows: 1
321 :stub-columns: 0
322 :widths: 30 5 5 5 55
323
324 * - Type
325 - ``minimum``
326 - ``step``
327 - ``maximum``
328 - Description
329 * - ``V4L2_CTRL_TYPE_INTEGER``
330 - any
331 - any
332 - any
333 - An integer-valued control ranging from minimum to maximum
334 inclusive. The step value indicates the increment between values.
335 * - ``V4L2_CTRL_TYPE_BOOLEAN``
336 - 0
337 - 1
338 - 1
339 - A boolean-valued control. Zero corresponds to "disabled", and one
340 means "enabled".
341 * - ``V4L2_CTRL_TYPE_MENU``
342 - ≥ 0
343 - 1
344 - N-1
345 - The control has a menu of N choices. The names of the menu items
346 can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl.
347 * - ``V4L2_CTRL_TYPE_INTEGER_MENU``
348 - ≥ 0
349 - 1
350 - N-1
351 - The control has a menu of N choices. The values of the menu items
352 can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl. This is
353 similar to ``V4L2_CTRL_TYPE_MENU`` except that instead of strings,
354 the menu items are signed 64-bit integers.
355 * - ``V4L2_CTRL_TYPE_BITMASK``
356 - 0
357 - n/a
358 - any
359 - A bitmask field. The maximum value is the set of bits that can be
360 used, all other bits are to be 0. The maximum value is interpreted
361 as a __u32, allowing the use of bit 31 in the bitmask.
362 * - ``V4L2_CTRL_TYPE_BUTTON``
363 - 0
364 - 0
365 - 0
366 - A control which performs an action when set. Drivers must ignore
367 the value passed with ``VIDIOC_S_CTRL`` and return an ``EACCES`` error
368 code on a ``VIDIOC_G_CTRL`` attempt.
369 * - ``V4L2_CTRL_TYPE_INTEGER64``
370 - any
371 - any
372 - any
373 - A 64-bit integer valued control. Minimum, maximum and step size
374 cannot be queried using ``VIDIOC_QUERYCTRL``. Only
375 ``VIDIOC_QUERY_EXT_CTRL`` can retrieve the 64-bit min/max/step
376 values, they should be interpreted as n/a when using
377 ``VIDIOC_QUERYCTRL``.
378 * - ``V4L2_CTRL_TYPE_STRING``
379 - ≥ 0
380 - ≥ 1
381 - ≥ 0
382 - The minimum and maximum string lengths. The step size means that
383 the string must be (minimum + N * step) characters long for N ≥ 0.
384 These lengths do not include the terminating zero, so in order to
385 pass a string of length 8 to
386 :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` you need to
387 set the ``size`` field of struct
388 :c:type:`v4l2_ext_control` to 9. For
389 :ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` you can set
390 the ``size`` field to ``maximum`` + 1. Which character encoding is
391 used will depend on the string control itself and should be part
392 of the control documentation.
393 * - ``V4L2_CTRL_TYPE_CTRL_CLASS``
394 - n/a
395 - n/a
396 - n/a
397 - This is not a control. When ``VIDIOC_QUERYCTRL`` is called with a
398 control ID equal to a control class code (see :ref:`ctrl-class`)
399 + 1, the ioctl returns the name of the control class and this
400 control type. Older drivers which do not support this feature
401 return an ``EINVAL`` error code.
402 * - ``V4L2_CTRL_TYPE_U8``
403 - any
404 - any
405 - any
406 - An unsigned 8-bit valued control ranging from minimum to maximum
407 inclusive. The step value indicates the increment between values.
408 * - ``V4L2_CTRL_TYPE_U16``
409 - any
410 - any
411 - any
412 - An unsigned 16-bit valued control ranging from minimum to maximum
413 inclusive. The step value indicates the increment between values.
414 * - ``V4L2_CTRL_TYPE_U32``
415 - any
416 - any
417 - any
418 - An unsigned 32-bit valued control ranging from minimum to maximum
419 inclusive. The step value indicates the increment between values.
420 * - ``V4L2_CTRL_TYPE_MPEG2_QUANTISATION``
421 - n/a
422 - n/a
423 - n/a
424 - A struct :c:type:`v4l2_ctrl_mpeg2_quantisation`, containing MPEG-2
425 quantisation matrices for stateless video decoders.
426 * - ``V4L2_CTRL_TYPE_MPEG2_SEQUENCE``
427 - n/a
428 - n/a
429 - n/a
430 - A struct :c:type:`v4l2_ctrl_mpeg2_sequence`, containing MPEG-2
431 sequence parameters for stateless video decoders.
432 * - ``V4L2_CTRL_TYPE_MPEG2_PICTURE``
433 - n/a
434 - n/a
435 - n/a
436 - A struct :c:type:`v4l2_ctrl_mpeg2_picture`, containing MPEG-2
437 picture parameters for stateless video decoders.
438 * - ``V4L2_CTRL_TYPE_AREA``
439 - n/a
440 - n/a
441 - n/a
442 - A struct :c:type:`v4l2_area`, containing the width and the height
443 of a rectangular area. Units depend on the use case.
444 * - ``V4L2_CTRL_TYPE_RECT``
445 - n/a
446 - n/a
447 - n/a
448 - A struct :c:type:`v4l2_rect`, containing a rectangle described by
449 the position of its top-left corner, the width and the height. Units
450 depend on the use case. Support for ``V4L2_CTRL_WHICH_MIN_VAL`` and
451 ``V4L2_CTRL_WHICH_MAX_VAL`` is optional and depends on the
452 ``V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX`` flag. See the documentation of
453 the specific control on how to interpret the minimum and maximum values.
454 * - ``V4L2_CTRL_TYPE_H264_SPS``
455 - n/a
456 - n/a
457 - n/a
458 - A struct :c:type:`v4l2_ctrl_h264_sps`, containing H264
459 sequence parameters for stateless video decoders.
460 * - ``V4L2_CTRL_TYPE_H264_PPS``
461 - n/a
462 - n/a
463 - n/a
464 - A struct :c:type:`v4l2_ctrl_h264_pps`, containing H264
465 picture parameters for stateless video decoders.
466 * - ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``
467 - n/a
468 - n/a
469 - n/a
470 - A struct :c:type:`v4l2_ctrl_h264_scaling_matrix`, containing H264
471 scaling matrices for stateless video decoders.
472 * - ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``
473 - n/a
474 - n/a
475 - n/a
476 - A struct :c:type:`v4l2_ctrl_h264_slice_params`, containing H264
477 slice parameters for stateless video decoders.
478 * - ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``
479 - n/a
480 - n/a
481 - n/a
482 - A struct :c:type:`v4l2_ctrl_h264_decode_params`, containing H264
483 decode parameters for stateless video decoders.
484 * - ``V4L2_CTRL_TYPE_FWHT_PARAMS``
485 - n/a
486 - n/a
487 - n/a
488 - A struct :c:type:`v4l2_ctrl_fwht_params`, containing FWHT
489 parameters for stateless video decoders.
490 * - ``V4L2_CTRL_TYPE_HEVC_SPS``
491 - n/a
492 - n/a
493 - n/a
494 - A struct :c:type:`v4l2_ctrl_hevc_sps`, containing HEVC Sequence
495 Parameter Set for stateless video decoders.
496 * - ``V4L2_CTRL_TYPE_HEVC_PPS``
497 - n/a
498 - n/a
499 - n/a
500 - A struct :c:type:`v4l2_ctrl_hevc_pps`, containing HEVC Picture
501 Parameter Set for stateless video decoders.
502 * - ``V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS``
503 - n/a
504 - n/a
505 - n/a
506 - A struct :c:type:`v4l2_ctrl_hevc_slice_params`, containing HEVC
507 slice parameters for stateless video decoders.
508 * - ``V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX``
509 - n/a
510 - n/a
511 - n/a
512 - A struct :c:type:`v4l2_ctrl_hevc_scaling_matrix`, containing HEVC
513 scaling matrix for stateless video decoders.
514 * - ``V4L2_CTRL_TYPE_VP8_FRAME``
515 - n/a
516 - n/a
517 - n/a
518 - A struct :c:type:`v4l2_ctrl_vp8_frame`, containing VP8
519 frame parameters for stateless video decoders.
520 * - ``V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS``
521 - n/a
522 - n/a
523 - n/a
524 - A struct :c:type:`v4l2_ctrl_hevc_decode_params`, containing HEVC
525 decoding parameters for stateless video decoders.
526 * - ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR``
527 - n/a
528 - n/a
529 - n/a
530 - A struct :c:type:`v4l2_ctrl_vp9_compressed_hdr`, containing VP9
531 probabilities updates for stateless video decoders.
532 * - ``V4L2_CTRL_TYPE_VP9_FRAME``
533 - n/a
534 - n/a
535 - n/a
536 - A struct :c:type:`v4l2_ctrl_vp9_frame`, containing VP9
537 frame decode parameters for stateless video decoders.
538 * - ``V4L2_CTRL_TYPE_AV1_SEQUENCE``
539 - n/a
540 - n/a
541 - n/a
542 - A struct :c:type:`v4l2_ctrl_av1_sequence`, containing AV1 Sequence OBU
543 decoding parameters for stateless video decoders.
544 * - ``V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY``
545 - n/a
546 - n/a
547 - n/a
548 - A struct :c:type:`v4l2_ctrl_av1_tile_group_entry`, containing AV1 Tile Group
549 OBU decoding parameters for stateless video decoders.
550 * - ``V4L2_CTRL_TYPE_AV1_FRAME``
551 - n/a
552 - n/a
553 - n/a
554 - A struct :c:type:`v4l2_ctrl_av1_frame`, containing AV1 Frame/Frame
555 Header OBU decoding parameters for stateless video decoders.
556 * - ``V4L2_CTRL_TYPE_AV1_FILM_GRAIN``
557 - n/a
558 - n/a
559 - n/a
560 - A struct :c:type:`v4l2_ctrl_av1_film_grain`, containing AV1 Film Grain
561 parameters for stateless video decoders.
562
563 .. raw:: latex
564
565 \normalsize
566
567 .. tabularcolumns:: |p{7.3cm}|p{1.8cm}|p{8.2cm}|
568
569 .. cssclass:: longtable
570
571 .. _control-flags:
572
573 .. flat-table:: Control Flags
574 :header-rows: 0
575 :stub-columns: 0
576 :widths: 3 1 4
577
578 * - ``V4L2_CTRL_FLAG_DISABLED``
579 - 0x0001
580 - This control is permanently disabled and should be ignored by the
581 application. Any attempt to change the control will result in an
582 ``EINVAL`` error code.
583 * - ``V4L2_CTRL_FLAG_GRABBED``
584 - 0x0002
585 - This control is temporarily unchangeable, for example because
586 another application took over control of the respective resource.
587 Such controls may be displayed specially in a user interface.
588 Attempts to change the control may result in an ``EBUSY`` error code.
589 * - ``V4L2_CTRL_FLAG_READ_ONLY``
590 - 0x0004
591 - This control is permanently readable only. Any attempt to change
592 the control will result in an ``EINVAL`` error code.
593 * - ``V4L2_CTRL_FLAG_UPDATE``
594 - 0x0008
595 - A hint that changing this control may affect the value of other
596 controls within the same control class. Applications should update
597 their user interface accordingly.
598 * - ``V4L2_CTRL_FLAG_INACTIVE``
599 - 0x0010
600 - This control is not applicable to the current configuration and
601 should be displayed accordingly in a user interface. For example
602 the flag may be set on a MPEG audio level 2 bitrate control when
603 MPEG audio encoding level 1 was selected with another control.
604 * - ``V4L2_CTRL_FLAG_SLIDER``
605 - 0x0020
606 - A hint that this control is best represented as a slider-like
607 element in a user interface.
608 * - ``V4L2_CTRL_FLAG_WRITE_ONLY``
609 - 0x0040
610 - This control is permanently writable only. Any attempt to read the
611 control will result in an ``EACCES`` error code error code. This flag
612 is typically present for relative controls or action controls
613 where writing a value will cause the device to carry out a given
614 action (e. g. motor control) but no meaningful value can be
615 returned.
616 * - ``V4L2_CTRL_FLAG_VOLATILE``
617 - 0x0080
618 - This control is volatile, which means that the value of the
619 control changes continuously. A typical example would be the
620 current gain value if the device is in auto-gain mode. In such a
621 case the hardware calculates the gain value based on the lighting
622 conditions which can change over time.
623
624 .. note::
625
626 Setting a new value for a volatile control will be ignored
627 unless
628 :ref:`V4L2_CTRL_FLAG_EXECUTE_ON_WRITE <FLAG_EXECUTE_ON_WRITE>`
629 is also set.
630 Setting a new value for a volatile control will *never* trigger a
631 :ref:`V4L2_EVENT_CTRL_CH_VALUE <ctrl-changes-flags>` event.
632 * - ``V4L2_CTRL_FLAG_HAS_PAYLOAD``
633 - 0x0100
634 - This control has a pointer type, so its value has to be accessed
635 using one of the pointer fields of struct
636 :c:type:`v4l2_ext_control`. This flag is set
637 for controls that are an array, string, or have a compound type.
638 In all cases you have to set a pointer to memory containing the
639 payload of the control.
640 * .. _FLAG_EXECUTE_ON_WRITE:
641
642 - ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE``
643 - 0x0200
644 - The value provided to the control will be propagated to the driver
645 even if it remains constant. This is required when the control
646 represents an action on the hardware. For example: clearing an
647 error flag or triggering the flash. All the controls of the type
648 ``V4L2_CTRL_TYPE_BUTTON`` have this flag set.
649 * .. _FLAG_MODIFY_LAYOUT:
650
651 - ``V4L2_CTRL_FLAG_MODIFY_LAYOUT``
652 - 0x0400
653 - Changing this control value may modify the layout of the
654 buffer (for video devices) or the media bus format (for sub-devices).
655
656 A typical example would be the ``V4L2_CID_ROTATE`` control.
657
658 Note that typically controls with this flag will also set the
659 ``V4L2_CTRL_FLAG_GRABBED`` flag when buffers are allocated or
660 streaming is in progress since most drivers do not support changing
661 the format in that case.
662 * - ``V4L2_CTRL_FLAG_DYNAMIC_ARRAY``
663 - 0x0800
664 - This control is a dynamically sized 1-dimensional array. It
665 behaves the same as a regular array, except that the number
666 of elements as reported by the ``elems`` field is between 1 and
667 ``dims[0]``. So setting the control with a differently sized
668 array will change the ``elems`` field when the control is
669 queried afterwards.
670 * - ``V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX``
671 - 0x1000
672 - This control supports getting minimum and maximum values using
673 vidioc_g_ext_ctrls with V4L2_CTRL_WHICH_MIN/MAX_VAL.
674
675 Return Value
676 ============
677
678 On success 0 is returned, on error -1 and the ``errno`` variable is set
679 appropriately. The generic error codes are described at the
680 :ref:`Generic Error Codes <gen-errors>` chapter.
681
682 EINVAL
683 The struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``id`` is
684 invalid. The struct :ref:`v4l2_querymenu <v4l2-querymenu>` ``id``
685 is invalid or ``index`` is out of range (less than ``minimum`` or
686 greater than ``maximum``) or this particular menu item is not
687 supported by the driver.
688
689 EACCES
690 An attempt was made to read a write-only control.
691
692 .. [#f1]
693 ``V4L2_CTRL_FLAG_DISABLED`` was intended for two purposes: Drivers
694 can skip predefined controls not supported by the hardware (although
695 returning ``EINVAL`` would do as well), or disable predefined and private
696 controls after hardware detection without the trouble of reordering
697 control arrays and indices (``EINVAL`` cannot be used to skip private
698 controls because it would prematurely end the enumeration).
699

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

목적, 호출 형식과 인자

1-37

`VIDIOC_QUERYCTRL`과 `VIDIOC_QUERY_EXT_CTRL`은 control의 속성을 조회·열거하고, `VIDIOC_QUERYMENU`는 menu control의 항목 이름 또는 정수 값을 조회합니다.

세 ioctl의 구조체
명령구조체용도
`VIDIOC_QUERYCTRL``struct v4l2_queryctrl`기본 control 속성
`VIDIOC_QUERY_EXT_CTRL``struct v4l2_query_ext_ctrl`64비트 범위와 compound·array 정보를 포함한 확장 속성
`VIDIOC_QUERYMENU``struct v4l2_querymenu`menu 또는 integer-menu 항목

명령에 맞는 `argp` 형식을 사용합니다.

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L

.. _VIDIOC_QUERYCTRL:

*******************************************************************
ioctls VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL and VIDIOC_QUERYMENU
*******************************************************************

Name
====

VIDIOC_QUERYCTRL - VIDIOC_QUERY_EXT_CTRL - VIDIOC_QUERYMENU - Enumerate controls and menu control items

Synopsis
========

``int ioctl(int fd, int VIDIOC_QUERYCTRL, struct v4l2_queryctrl *argp)``

.. c:macro:: VIDIOC_QUERY_EXT_CTRL

``int ioctl(int fd, VIDIOC_QUERY_EXT_CTRL, struct v4l2_query_ext_ctrl *argp)``

.. c:macro:: VIDIOC_QUERYMENU

``int ioctl(int fd, VIDIOC_QUERYMENU, struct v4l2_querymenu *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``
    Pointer to struct :c:type:`v4l2_queryctrl`, :c:type:`v4l2_query_ext_ctrl`
    or :c:type:`v4l2_querymenu` (depending on the ioctl).

Control과 menu 열거

38-98

특정 control은 `v4l2_queryctrl.id`를 지정해 조회합니다. 드라이버는 나머지 필드를 채우며 id가 잘못되면 `EINVAL`을 반환합니다.

Control 열거 방식
방식방법종료
표준 control`V4L2_CID_BASE`부터 `V4L2_CID_LASTP1` 직전까지 id 증가지원하지 않는 id마다 `EINVAL` 가능
Private control`V4L2_CID_PRIVATE_BASE`부터 id 증가첫 `EINVAL`에서 종료
다음 일반 controlid에 `V4L2_CTRL_FLAG_NEXT_CTRL` OR다음 non-compound control 또는 `EINVAL`
다음 compound controlid에 `V4L2_CTRL_FLAG_NEXT_COMPOUND` OR다음 compound/array control 또는 `EINVAL`
모든 control두 NEXT flag를 모두 OR다음 control 종류와 무관하게 반환

표준·private·next flag 방식의 시작점과 종료 조건입니다.

`V4L2_CTRL_FLAG_DISABLED`가 설정된 control은 영구 비활성 상태이므로 애플리케이션이 무시해야 합니다. NEXT flag를 아직 지원하지 않는 드라이버는 항상 `EINVAL`을 반환합니다.

Compound control은 type이 `V4L2_CTRL_COMPOUND_TYPES` 이상이거나 array control처럼 값이 둘 이상인 control입니다. 확장 query ioctl은 기존 `v4l2_queryctrl`에 더 넣을 공간이 없어 제공하지 못한 이 정보를 노출하기 위해 도입됐습니다.

`VIDIOC_QUERY_EXT_CTRL`의 사용법은 기본 query와 같지만 `reserved[32]`도 0으로 초기화해야 합니다.

Menu 항목은 `v4l2_querymenu.id`와 `index`를 지정해 조회합니다. Index는 해당 queryctrl의 `minimum`부터 `maximum`까지이며 양 끝을 포함합니다.

범위 안의 특정 index도 드라이버가 지원하지 않아 `EINVAL`일 수 있습니다. `minimum`이 반드시 0인 것도 아니므로 0에서 시작한다고 가정하면 안 됩니다.

Description
===========

To query the attributes of a control applications set the ``id`` field
of a struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` and call the
``VIDIOC_QUERYCTRL`` ioctl with a pointer to this structure. The driver
fills the rest of the structure or returns an ``EINVAL`` error code when the
``id`` is invalid.

It is possible to enumerate controls by calling ``VIDIOC_QUERYCTRL``
with successive ``id`` values starting from ``V4L2_CID_BASE`` up to and
exclusive ``V4L2_CID_LASTP1``. Drivers may return ``EINVAL`` if a control in
this range is not supported. Further applications can enumerate private
controls, which are not defined in this specification, by starting at
``V4L2_CID_PRIVATE_BASE`` and incrementing ``id`` until the driver
returns ``EINVAL``.

In both cases, when the driver sets the ``V4L2_CTRL_FLAG_DISABLED`` flag
in the ``flags`` field this control is permanently disabled and should
be ignored by the application. [#f1]_

When the application ORs ``id`` with ``V4L2_CTRL_FLAG_NEXT_CTRL`` the
driver returns the next supported non-compound control, or ``EINVAL`` if
there is none. In addition, the ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` flag
can be specified to enumerate all compound controls (i.e. controls with
type ≥ ``V4L2_CTRL_COMPOUND_TYPES`` and/or array control, in other words
controls that contain more than one value). Specify both
``V4L2_CTRL_FLAG_NEXT_CTRL`` and ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` in
order to enumerate all controls, compound or not. Drivers which do not
support these flags yet always return ``EINVAL``.

The ``VIDIOC_QUERY_EXT_CTRL`` ioctl was introduced in order to better
support controls that can use compound types, and to expose additional
control information that cannot be returned in struct
:ref:`v4l2_queryctrl <v4l2-queryctrl>` since that structure is full.

``VIDIOC_QUERY_EXT_CTRL`` is used in the same way as
``VIDIOC_QUERYCTRL``, except that the ``reserved`` array must be zeroed
as well.

Additional information is required for menu controls: the names of the
menu items. To query them applications set the ``id`` and ``index``
fields of struct :ref:`v4l2_querymenu <v4l2-querymenu>` and call the
``VIDIOC_QUERYMENU`` ioctl with a pointer to this structure. The driver
fills the rest of the structure or returns an ``EINVAL`` error code when the
``id`` or ``index`` is invalid. Menu items are enumerated by calling
``VIDIOC_QUERYMENU`` with successive ``index`` values from struct
:ref:`v4l2_queryctrl <v4l2-queryctrl>` ``minimum`` to ``maximum``,
inclusive.

.. note::

   It is possible for ``VIDIOC_QUERYMENU`` to return
   an ``EINVAL`` error code for some indices between ``minimum`` and
   ``maximum``. In that case that particular menu item is not supported by
   this driver. Also note that the ``minimum`` value is not necessarily 0.

See also the examples in :ref:`control`.

.. tabularcolumns:: |p{1.2cm}|p{3.6cm}|p{12.5cm}|

struct v4l2_queryctrl

99-176
v4l2_queryctrl 필드
형식필드의미
`__u32``id`애플리케이션이 지정하는 control ID. `NEXT_CTRL`과 OR하면 더 큰 첫 지원 ID를 반환하고 flag는 제거
`__u32``type``enum v4l2_ctrl_type`
`__u8[32]``name[32]`사용자 표시용 NUL 종료 ASCII 이름
`__s32``minimum`포함되는 최솟값
`__s32``maximum`포함되는 최댓값
`__s32``step`control을 실제로 변화시키는 최소 증분. 양수여야 함
`__s32``default_value`INTEGER·BOOLEAN·BITMASK·MENU·INTEGER_MENU의 기본값
`__u32``flags`control flag 집합
`__u32[2]``reserved[2]`향후 확장용. 드라이버가 0으로 설정

기본 control의 32비트 범위·step·기본값과 flag를 반환합니다.

문서 원문은 `step`의 C 필드를 `__s32`로 표시하지만 의미상 항상 양수입니다. Minimum과 maximum은 signed 32-bit입니다.

드라이버는 일반적으로 하드웨어 control 값을 임의 scale하지 않아야 합니다. 이름이나 ID가 특정 단위를 암시하지만 하드웨어가 그 단위의 배수만 받는 경우에는 반복 read-write에서 오차가 누적되지 않게 올바르게 반올림해야 합니다.

예를 들어 하드웨어 register가 0-511인데 드라이버가 0-65535를 보고하면 실제 최소 변화량인 `step`은 128이어야 합니다. Slider가 아닌 keyboard·GUI button에서 이 정보가 특히 중요합니다.

드라이버는 처음 load될 때만 control을 기본값으로 reset하며 그 이후에는 자동 reset하지 않습니다.

.. _v4l2-queryctrl:

.. cssclass:: longtable

.. flat-table:: struct v4l2_queryctrl
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 2

    * - __u32
      - ``id``
      - Identifies the control, set by the application. See
	:ref:`control-id` for predefined IDs. When the ID is ORed with
	V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and
	returns the first control with a higher ID. Drivers which do not
	support this flag yet always return an ``EINVAL`` error code.
    * - __u32
      - ``type``
      - Type of control, see :c:type:`v4l2_ctrl_type`.
    * - __u8
      - ``name``\ [32]
      - Name of the control, a NUL-terminated ASCII string. This
	information is intended for the user.
    * - __s32
      - ``minimum``
      - Minimum value, inclusive. This field gives a lower bound for the
	control. See enum :c:type:`v4l2_ctrl_type` how
	the minimum value is to be used for each possible control type.
	Note that this a signed 32-bit value.
    * - __s32
      - ``maximum``
      - Maximum value, inclusive. This field gives an upper bound for the
	control. See enum :c:type:`v4l2_ctrl_type` how
	the maximum value is to be used for each possible control type.
	Note that this a signed 32-bit value.
    * - __s32
      - ``step``
      - This field gives a step size for the control. See enum
	:c:type:`v4l2_ctrl_type` how the step value is
	to be used for each possible control type. Note that this an
	unsigned 32-bit value.

	Generally drivers should not scale hardware control values. It may
	be necessary for example when the ``name`` or ``id`` imply a
	particular unit and the hardware actually accepts only multiples
	of said unit. If so, drivers must take care values are properly
	rounded when scaling, such that errors will not accumulate on
	repeated read-write cycles.

	This field gives the smallest change of an integer control
	actually affecting hardware. Often the information is needed when
	the user can change controls by keyboard or GUI buttons, rather
	than a slider. When for example a hardware register accepts values
	0-511 and the driver reports 0-65535, step should be 128.

	Note that although signed, the step value is supposed to be always
	positive.
    * - __s32
      - ``default_value``
      - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_BOOLEAN``,
	``_BITMASK``, ``_MENU`` or ``_INTEGER_MENU`` control. Not valid
	for other types of controls.

	.. note::

	   Drivers reset controls to their default value only when
	   the driver is first loaded, never afterwards.
    * - __u32
      - ``flags``
      - Control flags, see :ref:`control-flags`.
    * - __u32
      - ``reserved``\ [2]
      - Reserved for future extensions. Drivers must set the array to
	zero.


.. tabularcolumns:: |p{1.2cm}|p{5.5cm}|p{10.6cm}|

struct v4l2_query_ext_ctrl

177-276
확장 query의 공통 필드
형식필드의미
`__u32``id`NEXT_CTRL은 다음 non-compound, NEXT_COMPOUND는 다음 compound, 둘 다면 종류 무관 다음 control
`__u32``type``enum v4l2_ctrl_type`
`char[32]``name[32]`사용자 표시용 NUL 종료 ASCII 이름
`__s64``minimum`포함되는 64비트 최솟값
`__s64``maximum`포함되는 64비트 최댓값
`__u64``step`64비트 unsigned 증분
`__s64``default_value`INTEGER·INTEGER64·BOOLEAN·BITMASK·MENU·INTEGER_MENU·U8·U16의 기본값
`__u32``flags`control flag 집합

기본 구조체보다 넓은 값 범위와 상세 array 정보를 제공합니다.

64비트 `step`도 하드웨어에서 실제 효과가 나는 최소 변화량이며, scale이 불가피할 때 반복 변환 오차가 누적되지 않도록 반올림해야 합니다.

Compound·array 메타데이터
필드의미
`elem_size`원소 하나의 바이트 크기. Array가 아니어도 항상 유효하며 string은 `maximum + 1`
`elems`N차원 배열 원소 수. Array가 아니면 1이고 절대 0이 아님
`nr_of_dims`차원 수. Array가 아니면 0
`dims[V4L2_CTRL_MAX_DIMS]`앞의 `nr_of_dims` 원소는 0이 아니어야 하고 나머지는 모두 0
`reserved[32]`향후 확장용. 애플리케이션과 드라이버가 모두 0으로 설정

N차원 payload의 크기와 배치를 설명합니다.

p + ((z * dims[1] + y) * dims[0] + x) * elem_size

위 식은 `char *p`가 가리키는 3차원 array에서 `(z, y, x)` cell의 바이트 주소를 계산합니다.

확장 구조체에서도 드라이버는 처음 load될 때만 control을 기본값으로 reset합니다.

.. _v4l2-query-ext-ctrl:

.. cssclass:: longtable

.. flat-table:: struct v4l2_query_ext_ctrl
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 2

    * - __u32
      - ``id``
      - Identifies the control, set by the application. See
	:ref:`control-id` for predefined IDs. When the ID is ORed with
	``V4L2_CTRL_FLAG_NEXT_CTRL`` the driver clears the flag and
	returns the first non-compound control with a higher ID. When the
	ID is ORed with ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` the driver clears
	the flag and returns the first compound control with a higher ID.
	Set both to get the first control (compound or not) with a higher
	ID.
    * - __u32
      - ``type``
      - Type of control, see :c:type:`v4l2_ctrl_type`.
    * - char
      - ``name``\ [32]
      - Name of the control, a NUL-terminated ASCII string. This
	information is intended for the user.
    * - __s64
      - ``minimum``
      - Minimum value, inclusive. This field gives a lower bound for the
	control. See enum :c:type:`v4l2_ctrl_type` how
	the minimum value is to be used for each possible control type.
	Note that this a signed 64-bit value.
    * - __s64
      - ``maximum``
      - Maximum value, inclusive. This field gives an upper bound for the
	control. See enum :c:type:`v4l2_ctrl_type` how
	the maximum value is to be used for each possible control type.
	Note that this a signed 64-bit value.
    * - __u64
      - ``step``
      - This field gives a step size for the control. See enum
	:c:type:`v4l2_ctrl_type` how the step value is
	to be used for each possible control type. Note that this an
	unsigned 64-bit value.

	Generally drivers should not scale hardware control values. It may
	be necessary for example when the ``name`` or ``id`` imply a
	particular unit and the hardware actually accepts only multiples
	of said unit. If so, drivers must take care values are properly
	rounded when scaling, such that errors will not accumulate on
	repeated read-write cycles.

	This field gives the smallest change of an integer control
	actually affecting hardware. Often the information is needed when
	the user can change controls by keyboard or GUI buttons, rather
	than a slider. When for example a hardware register accepts values
	0-511 and the driver reports 0-65535, step should be 128.
    * - __s64
      - ``default_value``
      - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_INTEGER64``,
	``_BOOLEAN``, ``_BITMASK``, ``_MENU``, ``_INTEGER_MENU``, ``_U8``
	or ``_U16`` control. Not valid for other types of controls.

	.. note::

	   Drivers reset controls to their default value only when
	   the driver is first loaded, never afterwards.
    * - __u32
      - ``flags``
      - Control flags, see :ref:`control-flags`.
    * - __u32
      - ``elem_size``
      - The size in bytes of a single element of the array. Given a char
	pointer ``p`` to a 3-dimensional array you can find the position
	of cell ``(z, y, x)`` as follows:
	``p + ((z * dims[1] + y) * dims[0] + x) * elem_size``.
	``elem_size`` is always valid, also when the control isn't an
	array. For string controls ``elem_size`` is equal to
	``maximum + 1``.
    * - __u32
      - ``elems``
      - The number of elements in the N-dimensional array. If this control
	is not an array, then ``elems`` is 1. The ``elems`` field can
	never be 0.
    * - __u32
      - ``nr_of_dims``
      - The number of dimension in the N-dimensional array. If this
	control is not an array, then this field is 0.
    * - __u32
      - ``dims[V4L2_CTRL_MAX_DIMS]``
      - The size of each dimension. The first ``nr_of_dims`` elements of
	this array must be non-zero, all remaining elements must be zero.
    * - __u32
      - ``reserved``\ [32]
      - Reserved for future extensions. Applications and drivers must set
	the array to zero.


.. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{13.1cm}|

struct v4l2_querymenu

277-308
v4l2_querymenu 필드
형식필드의미
`__u32``id`해당 `v4l2_queryctrl.id`에서 가져온 control ID
`__u32``index`애플리케이션이 지정하는 menu 항목 index
`__u8[32]``name[32]`MENU용 NUL 종료 ASCII 항목 이름
`__s64``value`INTEGER_MENU용 signed 64-bit 항목 값
`__u32``reserved`향후 확장용. 드라이버가 0으로 설정

Control type에 따라 익명 union의 한 필드만 유효합니다.

.. _v4l2-querymenu:

.. flat-table:: struct v4l2_querymenu
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 2

    * - __u32
      - ``id``
      - Identifies the control, set by the application from the respective
	struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``id``.
    * - __u32
      - ``index``
      - Index of the menu item, starting at zero, set by the application.
    * - union {
      - (anonymous)
    * - __u8
      - ``name``\ [32]
      - Name of the menu item, a NUL-terminated ASCII string. This
	information is intended for the user. This field is valid for
	``V4L2_CTRL_TYPE_MENU`` type controls.
    * - __s64
      - ``value``
      - Value of the integer menu item. This field is valid for
	``V4L2_CTRL_TYPE_INTEGER_MENU`` type controls.
    * - }
      -
    * - __u32
      - ``reserved``
      - Reserved for future extensions. Drivers must set the array to
	zero.

enum v4l2_ctrl_type

309-570
기본 scalar·menu control
Type범위의미
`V4L2_CTRL_TYPE_INTEGER`min..max, 지정 step포함 범위의 정수
`V4L2_CTRL_TYPE_BOOLEAN`0, step 1, max 10은 disabled, 1은 enabled
`V4L2_CTRL_TYPE_MENU`항목 index 범위N개 문자열 선택지; QUERYMENU로 이름 열거
`V4L2_CTRL_TYPE_INTEGER_MENU`항목 index 범위N개 signed 64-bit 선택지; QUERYMENU로 값 열거
`V4L2_CTRL_TYPE_BITMASK`0..maximummaximum에 설정된 비트만 사용 가능; `__u32`로 해석해 bit 31 허용
`V4L2_CTRL_TYPE_BUTTON`0set 시 동작 실행. S_CTRL 값은 무시하고 G_CTRL은 `EACCES`
`V4L2_CTRL_TYPE_INTEGER64`64-bitQUERYCTRL로 min/max/step 조회 불가; QUERY_EXT_CTRL만 가능
`V4L2_CTRL_TYPE_STRING`문자열 길이길이는 `minimum + N * step`; 종료 NUL은 길이에 미포함
`V4L2_CTRL_TYPE_CTRL_CLASS`n/a실제 control 아님. class code + 1을 query하면 class 이름 반환; 구형 드라이버는 `EINVAL`
`V4L2_CTRL_TYPE_U8`min..max, 지정 stepunsigned 8-bit
`V4L2_CTRL_TYPE_U16`min..max, 지정 stepunsigned 16-bit
`V4L2_CTRL_TYPE_U32`min..max, 지정 stepunsigned 32-bit

minimum·step·maximum의 해석과 접근 특성을 정리합니다.

길이 8인 string을 `VIDIOC_S_EXT_CTRLS`로 전달하려면 `v4l2_ext_control.size = 9`가 필요합니다. `VIDIOC_G_EXT_CTRLS`에서는 `size = maximum + 1`로 둘 수 있고, 문자 인코딩은 각 string control 문서가 정의합니다.

기하 구조체 control
TypePayload
`V4L2_CTRL_TYPE_AREA`폭·높이를 담은 `struct v4l2_area`
`V4L2_CTRL_TYPE_RECT`좌상단 위치·폭·높이의 `struct v4l2_rect`

단위와 min/max 해석은 각 control의 사용 사례가 정의합니다.

RECT에서 `V4L2_CTRL_WHICH_MIN_VAL`·`V4L2_CTRL_WHICH_MAX_VAL` 지원은 선택 사항이며 `V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX`에 달려 있습니다.

MPEG-2·H.264·FWHT compound control
Type구조체·내용
`V4L2_CTRL_TYPE_MPEG2_QUANTISATION``v4l2_ctrl_mpeg2_quantisation`; quantisation matrix
`V4L2_CTRL_TYPE_MPEG2_SEQUENCE``v4l2_ctrl_mpeg2_sequence`; sequence parameter
`V4L2_CTRL_TYPE_MPEG2_PICTURE``v4l2_ctrl_mpeg2_picture`; picture parameter
`V4L2_CTRL_TYPE_H264_SPS``v4l2_ctrl_h264_sps`; sequence parameter
`V4L2_CTRL_TYPE_H264_PPS``v4l2_ctrl_h264_pps`; picture parameter
`V4L2_CTRL_TYPE_H264_SCALING_MATRIX``v4l2_ctrl_h264_scaling_matrix`; scaling matrix
`V4L2_CTRL_TYPE_H264_SLICE_PARAMS``v4l2_ctrl_h264_slice_params`; slice parameter
`V4L2_CTRL_TYPE_H264_DECODE_PARAMS``v4l2_ctrl_h264_decode_params`; decode parameter
`V4L2_CTRL_TYPE_FWHT_PARAMS``v4l2_ctrl_fwht_params`; FWHT parameter

Stateless decoder가 사용하는 구조체 payload입니다.

HEVC·VP8·VP9 compound control
Type구조체·내용
`V4L2_CTRL_TYPE_HEVC_SPS``v4l2_ctrl_hevc_sps`; Sequence Parameter Set
`V4L2_CTRL_TYPE_HEVC_PPS``v4l2_ctrl_hevc_pps`; Picture Parameter Set
`V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS``v4l2_ctrl_hevc_slice_params`; slice parameter
`V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX``v4l2_ctrl_hevc_scaling_matrix`; scaling matrix
`V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS``v4l2_ctrl_hevc_decode_params`; decode parameter
`V4L2_CTRL_TYPE_VP8_FRAME``v4l2_ctrl_vp8_frame`; frame parameter
`V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR``v4l2_ctrl_vp9_compressed_hdr`; probability update
`V4L2_CTRL_TYPE_VP9_FRAME``v4l2_ctrl_vp9_frame`; frame decode parameter

Codec별 stateless decode payload입니다.

AV1 compound control
Type구조체·내용
`V4L2_CTRL_TYPE_AV1_SEQUENCE``v4l2_ctrl_av1_sequence`; Sequence OBU
`V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY``v4l2_ctrl_av1_tile_group_entry`; Tile Group OBU
`V4L2_CTRL_TYPE_AV1_FRAME``v4l2_ctrl_av1_frame`; Frame/Frame Header OBU
`V4L2_CTRL_TYPE_AV1_FILM_GRAIN``v4l2_ctrl_av1_film_grain`; film grain parameter

AV1 OBU와 film grain decoding payload입니다.

.. c:type:: v4l2_ctrl_type

.. raw:: latex

   \footnotesize

.. tabularcolumns:: |p{6.5cm}|p{1.5cm}|p{1.1cm}|p{1.5cm}|p{6.8cm}|

.. cssclass:: longtable

.. flat-table:: enum v4l2_ctrl_type
    :header-rows:  1
    :stub-columns: 0
    :widths:       30 5 5 5 55

    * - Type
      - ``minimum``
      - ``step``
      - ``maximum``
      - Description
    * - ``V4L2_CTRL_TYPE_INTEGER``
      - any
      - any
      - any
      - An integer-valued control ranging from minimum to maximum
	inclusive. The step value indicates the increment between values.
    * - ``V4L2_CTRL_TYPE_BOOLEAN``
      - 0
      - 1
      - 1
      - A boolean-valued control. Zero corresponds to "disabled", and one
	means "enabled".
    * - ``V4L2_CTRL_TYPE_MENU``
      - ≥ 0
      - 1
      - N-1
      - The control has a menu of N choices. The names of the menu items
	can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl.
    * - ``V4L2_CTRL_TYPE_INTEGER_MENU``
      - ≥ 0
      - 1
      - N-1
      - The control has a menu of N choices. The values of the menu items
	can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl. This is
	similar to ``V4L2_CTRL_TYPE_MENU`` except that instead of strings,
	the menu items are signed 64-bit integers.
    * - ``V4L2_CTRL_TYPE_BITMASK``
      - 0
      - n/a
      - any
      - A bitmask field. The maximum value is the set of bits that can be
	used, all other bits are to be 0. The maximum value is interpreted
	as a __u32, allowing the use of bit 31 in the bitmask.
    * - ``V4L2_CTRL_TYPE_BUTTON``
      - 0
      - 0
      - 0
      - A control which performs an action when set. Drivers must ignore
	the value passed with ``VIDIOC_S_CTRL`` and return an ``EACCES`` error
	code on a ``VIDIOC_G_CTRL`` attempt.
    * - ``V4L2_CTRL_TYPE_INTEGER64``
      - any
      - any
      - any
      - A 64-bit integer valued control. Minimum, maximum and step size
	cannot be queried using ``VIDIOC_QUERYCTRL``. Only
	``VIDIOC_QUERY_EXT_CTRL`` can retrieve the 64-bit min/max/step
	values, they should be interpreted as n/a when using
	``VIDIOC_QUERYCTRL``.
    * - ``V4L2_CTRL_TYPE_STRING``
      - ≥ 0
      - ≥ 1
      - ≥ 0
      - The minimum and maximum string lengths. The step size means that
	the string must be (minimum + N * step) characters long for N ≥ 0.
	These lengths do not include the terminating zero, so in order to
	pass a string of length 8 to
	:ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` you need to
	set the ``size`` field of struct
	:c:type:`v4l2_ext_control` to 9. For
	:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` you can set
	the ``size`` field to ``maximum`` + 1. Which character encoding is
	used will depend on the string control itself and should be part
	of the control documentation.
    * - ``V4L2_CTRL_TYPE_CTRL_CLASS``
      - n/a
      - n/a
      - n/a
      - This is not a control. When ``VIDIOC_QUERYCTRL`` is called with a
	control ID equal to a control class code (see :ref:`ctrl-class`)
	+ 1, the ioctl returns the name of the control class and this
	control type. Older drivers which do not support this feature
	return an ``EINVAL`` error code.
    * - ``V4L2_CTRL_TYPE_U8``
      - any
      - any
      - any
      - An unsigned 8-bit valued control ranging from minimum to maximum
	inclusive. The step value indicates the increment between values.
    * - ``V4L2_CTRL_TYPE_U16``
      - any
      - any
      - any
      - An unsigned 16-bit valued control ranging from minimum to maximum
	inclusive. The step value indicates the increment between values.
    * - ``V4L2_CTRL_TYPE_U32``
      - any
      - any
      - any
      - An unsigned 32-bit valued control ranging from minimum to maximum
	inclusive. The step value indicates the increment between values.
    * - ``V4L2_CTRL_TYPE_MPEG2_QUANTISATION``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_mpeg2_quantisation`, containing MPEG-2
	quantisation matrices for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_MPEG2_SEQUENCE``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_mpeg2_sequence`, containing MPEG-2
	sequence parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_MPEG2_PICTURE``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_mpeg2_picture`, containing MPEG-2
	picture parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_AREA``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_area`, containing the width and the height
        of a rectangular area. Units depend on the use case.
    * - ``V4L2_CTRL_TYPE_RECT``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_rect`, containing a rectangle described by
	the position of its top-left corner, the width and the height. Units
	depend on the use case. Support for ``V4L2_CTRL_WHICH_MIN_VAL`` and
	``V4L2_CTRL_WHICH_MAX_VAL`` is optional and depends on the
	``V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX`` flag. See the documentation of
	the specific control on how to interpret the minimum and maximum values.
    * - ``V4L2_CTRL_TYPE_H264_SPS``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_h264_sps`, containing H264
	sequence parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_H264_PPS``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_h264_pps`, containing H264
	picture parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_H264_SCALING_MATRIX``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_h264_scaling_matrix`, containing H264
	scaling matrices for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_H264_SLICE_PARAMS``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_h264_slice_params`, containing H264
	slice parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_H264_DECODE_PARAMS``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_h264_decode_params`, containing H264
	decode parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_FWHT_PARAMS``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_fwht_params`, containing FWHT
	parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_HEVC_SPS``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_hevc_sps`, containing HEVC Sequence
	Parameter Set for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_HEVC_PPS``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_hevc_pps`, containing HEVC Picture
	Parameter Set for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_hevc_slice_params`, containing HEVC
	slice parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_hevc_scaling_matrix`, containing HEVC
	scaling matrix for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_VP8_FRAME``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_vp8_frame`, containing VP8
	frame parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_hevc_decode_params`, containing HEVC
	decoding parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_vp9_compressed_hdr`, containing VP9
	probabilities updates for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_VP9_FRAME``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_vp9_frame`, containing VP9
	frame decode parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_AV1_SEQUENCE``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_av1_sequence`, containing AV1 Sequence OBU
	decoding parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_av1_tile_group_entry`, containing AV1 Tile Group
	OBU decoding parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_AV1_FRAME``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_av1_frame`, containing AV1 Frame/Frame
	Header OBU decoding parameters for stateless video decoders.
    * - ``V4L2_CTRL_TYPE_AV1_FILM_GRAIN``
      - n/a
      - n/a
      - n/a
      - A struct :c:type:`v4l2_ctrl_av1_film_grain`, containing AV1 Film Grain
        parameters for stateless video decoders.

.. raw:: latex

   \normalsize

.. tabularcolumns:: |p{7.3cm}|p{1.8cm}|p{8.2cm}|

.. cssclass:: longtable

Control flag

571-674
접근·상태·UI flag
Flag의미
`V4L2_CTRL_FLAG_DISABLED``0x0001`영구 비활성. 무시해야 하며 변경 시 `EINVAL`
`V4L2_CTRL_FLAG_GRABBED``0x0002`다른 주체가 자원을 점유해 일시 변경 불가. 변경 시 `EBUSY` 가능
`V4L2_CTRL_FLAG_READ_ONLY``0x0004`영구 읽기 전용. 변경 시 `EINVAL`
`V4L2_CTRL_FLAG_UPDATE``0x0008`변경하면 같은 class의 다른 control 값에 영향 가능; UI 갱신 권고
`V4L2_CTRL_FLAG_INACTIVE``0x0010`현재 구성에는 적용되지 않음; UI에서 구분 표시
`V4L2_CTRL_FLAG_SLIDER``0x0020`slider 형태 UI가 적합하다는 힌트
`V4L2_CTRL_FLAG_WRITE_ONLY``0x0040`쓰기 전용. 읽기 시 `EACCES`; 상대값·motor action 등에 사용
`V4L2_CTRL_FLAG_VOLATILE``0x0080`값이 계속 변함. 예: auto-gain 중 현재 gain

Control의 현재 사용 가능 상태와 권장 UI 표현입니다.

Volatile control에 새 값을 써도 `V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`가 함께 없으면 무시됩니다. 값을 써도 `V4L2_EVENT_CTRL_CH_VALUE` event는 절대로 발생하지 않습니다.

Payload·실행·layout·array flag
Flag의미
`V4L2_CTRL_FLAG_HAS_PAYLOAD``0x0100`array·string·compound pointer payload. `v4l2_ext_control` pointer 필드로 접근
`V4L2_CTRL_FLAG_EXECUTE_ON_WRITE``0x0200`값이 같아도 드라이버에 전달해 hardware action 실행. 모든 BUTTON에 설정
`V4L2_CTRL_FLAG_MODIFY_LAYOUT``0x0400`video buffer layout 또는 subdevice media bus format을 바꿀 수 있음
`V4L2_CTRL_FLAG_DYNAMIC_ARRAY``0x0800`동적 길이 1차원 array. `elems`는 1..`dims[0]`이며 설정 길이에 따라 변경
`V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX``0x1000`G_EXT_CTRLS와 `V4L2_CTRL_WHICH_MIN_VAL`/`MAX_VAL`로 최솟값·최댓값 조회 지원

확장 control의 메모리와 동작 특성을 나타냅니다.

`MODIFY_LAYOUT`의 대표 예는 `V4L2_CID_ROTATE`입니다. 대부분의 드라이버는 buffer 할당 후나 streaming 중 layout 변경을 지원하지 않으므로 이때 `GRABBED`도 함께 설정하는 것이 일반적입니다.

.. _control-flags:

.. flat-table:: Control Flags
    :header-rows:  0
    :stub-columns: 0
    :widths:       3 1 4

    * - ``V4L2_CTRL_FLAG_DISABLED``
      - 0x0001
      - This control is permanently disabled and should be ignored by the
	application. Any attempt to change the control will result in an
	``EINVAL`` error code.
    * - ``V4L2_CTRL_FLAG_GRABBED``
      - 0x0002
      - This control is temporarily unchangeable, for example because
	another application took over control of the respective resource.
	Such controls may be displayed specially in a user interface.
	Attempts to change the control may result in an ``EBUSY`` error code.
    * - ``V4L2_CTRL_FLAG_READ_ONLY``
      - 0x0004
      - This control is permanently readable only. Any attempt to change
	the control will result in an ``EINVAL`` error code.
    * - ``V4L2_CTRL_FLAG_UPDATE``
      - 0x0008
      - A hint that changing this control may affect the value of other
	controls within the same control class. Applications should update
	their user interface accordingly.
    * - ``V4L2_CTRL_FLAG_INACTIVE``
      - 0x0010
      - This control is not applicable to the current configuration and
	should be displayed accordingly in a user interface. For example
	the flag may be set on a MPEG audio level 2 bitrate control when
	MPEG audio encoding level 1 was selected with another control.
    * - ``V4L2_CTRL_FLAG_SLIDER``
      - 0x0020
      - A hint that this control is best represented as a slider-like
	element in a user interface.
    * - ``V4L2_CTRL_FLAG_WRITE_ONLY``
      - 0x0040
      - This control is permanently writable only. Any attempt to read the
	control will result in an ``EACCES`` error code error code. This flag
	is typically present for relative controls or action controls
	where writing a value will cause the device to carry out a given
	action (e. g. motor control) but no meaningful value can be
	returned.
    * - ``V4L2_CTRL_FLAG_VOLATILE``
      - 0x0080
      - This control is volatile, which means that the value of the
	control changes continuously. A typical example would be the
	current gain value if the device is in auto-gain mode. In such a
	case the hardware calculates the gain value based on the lighting
	conditions which can change over time.

	.. note::

	   Setting a new value for a volatile control will be ignored
	   unless
	   :ref:`V4L2_CTRL_FLAG_EXECUTE_ON_WRITE <FLAG_EXECUTE_ON_WRITE>`
	   is also set.
	   Setting a new value for a volatile control will *never* trigger a
	   :ref:`V4L2_EVENT_CTRL_CH_VALUE <ctrl-changes-flags>` event.
    * - ``V4L2_CTRL_FLAG_HAS_PAYLOAD``
      - 0x0100
      - This control has a pointer type, so its value has to be accessed
	using one of the pointer fields of struct
	:c:type:`v4l2_ext_control`. This flag is set
	for controls that are an array, string, or have a compound type.
	In all cases you have to set a pointer to memory containing the
	payload of the control.
    * .. _FLAG_EXECUTE_ON_WRITE:

      - ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE``
      - 0x0200
      - The value provided to the control will be propagated to the driver
	even if it remains constant. This is required when the control
	represents an action on the hardware. For example: clearing an
	error flag or triggering the flash. All the controls of the type
	``V4L2_CTRL_TYPE_BUTTON`` have this flag set.
    * .. _FLAG_MODIFY_LAYOUT:

      - ``V4L2_CTRL_FLAG_MODIFY_LAYOUT``
      - 0x0400
      - Changing this control value may modify the layout of the
        buffer (for video devices) or the media bus format (for sub-devices).

	A typical example would be the ``V4L2_CID_ROTATE`` control.

	Note that typically controls with this flag will also set the
	``V4L2_CTRL_FLAG_GRABBED`` flag when buffers are allocated or
	streaming is in progress since most drivers do not support changing
	the format in that case.
    * - ``V4L2_CTRL_FLAG_DYNAMIC_ARRAY``
      - 0x0800
      - This control is a dynamically sized 1-dimensional array. It
        behaves the same as a regular array, except that the number
	of elements as reported by the ``elems`` field is between 1 and
	``dims[0]``. So setting the control with a differently sized
	array will change the ``elems`` field when the control is
	queried afterwards.
    * - ``V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX``
      - 0x1000
      - This control supports getting minimum and maximum values using
        vidioc_g_ext_ctrls with V4L2_CTRL_WHICH_MIN/MAX_VAL.

반환값, 오류와 DISABLED 각주

675-698

성공하면 0, 오류이면 -1을 반환하고 `errno`를 설정합니다.

Query control 오류
errno조건
`EINVAL`queryctrl id가 잘못됨; querymenu id가 잘못됨; index가 minimum..maximum 밖; 해당 menu 항목을 드라이버가 지원하지 않음
`EACCES`write-only control 읽기 시도

Control ID, menu index와 접근 권한을 검사합니다.

`DISABLED` flag는 하드웨어가 지원하지 않는 predefined control을 건너뛰거나, hardware detection 후 control array와 index를 재정렬하지 않고 predefined/private control을 비활성화하려고 만들었습니다.

Private control 열거는 첫 `EINVAL`에서 끝나므로 중간 private control을 건너뛰는 용도로 `EINVAL`을 사용할 수 없습니다. 이런 경우 `DISABLED`가 열거 순서를 보존합니다.

Return Value
============

On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

EINVAL
    The struct :ref:`v4l2_queryctrl <v4l2-queryctrl>` ``id`` is
    invalid. The struct :ref:`v4l2_querymenu <v4l2-querymenu>` ``id``
    is invalid or ``index`` is out of range (less than ``minimum`` or
    greater than ``maximum``) or this particular menu item is not
    supported by the driver.

EACCES
    An attempt was made to read a write-only control.

.. [#f1]
   ``V4L2_CTRL_FLAG_DISABLED`` was intended for two purposes: Drivers
   can skip predefined controls not supported by the hardware (although
   returning ``EINVAL`` would do as well), or disable predefined and private
   controls after hardware detection without the trouble of reordering
   control arrays and indices (``EINVAL`` cannot be used to skip private
   controls because it would prematurely end the enumeration).