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

Linux 6.18.37 · 사용자 공간 API

VIDIOC_QUERYCAP ioctl

V4L2 장치·드라이버 식별 정보와 물리 장치 전체 capability, 열린 node별 device_caps, 모든 장치 기능 비트를 설명합니다.

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

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

1. 요약·해설

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

요약·해설

vidioc-querycap.rst:1-289

물리 장치 전체 기능과 현재 연 device node의 기능을 혼동하지 않는 것이 capability 탐색의 핵심입니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_QUERYCAP:
5
6 *********************
7 ioctl VIDIOC_QUERYCAP
8 *********************
9
10 Name
11 ====
12
13 VIDIOC_QUERYCAP - Query device capabilities
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_QUERYCAP
19
20 ``int ioctl(int fd, VIDIOC_QUERYCAP, struct v4l2_capability *argp)``
21
22 Arguments
23 =========
24
25 ``fd``
26 File descriptor returned by :c:func:`open()`.
27
28 ``argp``
29 Pointer to struct :c:type:`v4l2_capability`.
30
31 Description
32 ===========
33
34 All V4L2 devices support the ``VIDIOC_QUERYCAP`` ioctl. It is used to
35 identify kernel devices compatible with this specification and to obtain
36 information about driver and hardware capabilities. The ioctl takes a
37 pointer to a struct :c:type:`v4l2_capability` which is
38 filled by the driver. When the driver is not compatible with this
39 specification the ioctl returns an ``EINVAL`` error code.
40
41 .. c:type:: v4l2_capability
42
43 .. tabularcolumns:: |p{1.4cm}|p{2.8cm}|p{13.1cm}|
44
45 .. cssclass:: longtable
46
47 .. flat-table:: struct v4l2_capability
48 :header-rows: 0
49 :stub-columns: 0
50 :widths: 3 4 20
51
52 * - __u8
53 - ``driver``\ [16]
54 - Name of the driver, a unique NUL-terminated ASCII string. For
55 example: "bttv". Driver specific applications can use this
56 information to verify the driver identity. It is also useful to
57 work around known bugs, or to identify drivers in error reports.
58
59 Storing strings in fixed sized arrays is bad practice but
60 unavoidable here. Drivers and applications should take precautions
61 to never read or write beyond the end of the array and to make
62 sure the strings are properly NUL-terminated.
63 * - __u8
64 - ``card``\ [32]
65 - Name of the device, a NUL-terminated UTF-8 string. For example:
66 "Yoyodyne TV/FM". One driver may support different brands or
67 models of video hardware. This information is intended for users,
68 for example in a menu of available devices. Since multiple TV
69 cards of the same brand may be installed which are supported by
70 the same driver, this name should be combined with the character
71 device file name (e. g. ``/dev/video2``) or the ``bus_info``
72 string to avoid ambiguities.
73 * - __u8
74 - ``bus_info``\ [32]
75 - Location of the device in the system, a NUL-terminated ASCII
76 string. For example: "PCI:0000:05:06.0". This information is
77 intended for users, to distinguish multiple identical devices. If
78 no such information is available the field must simply count the
79 devices controlled by the driver ("platform:vivid-000"). The
80 bus_info must start with "PCI:" for PCI boards, "PCIe:" for PCI
81 Express boards, "usb-" for USB devices, "I2C:" for i2c devices,
82 "ISA:" for ISA devices, "parport" for parallel port devices and
83 "platform:" for platform devices.
84 * - __u32
85 - ``version``
86 - Version number of the driver.
87
88 Starting with kernel 3.1, the version reported is provided by the
89 V4L2 subsystem following the kernel numbering scheme. However, it
90 may not always return the same version as the kernel if, for
91 example, a stable or distribution-modified kernel uses the V4L2
92 stack from a newer kernel.
93
94 The version number is formatted using the ``KERNEL_VERSION()``
95 macro. For example if the media stack corresponds to the V4L2
96 version shipped with Kernel 4.14, it would be equivalent to:
97 * - :cspan:`2`
98
99 ``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
100
101 ``__u32 version = KERNEL_VERSION(4, 14, 0);``
102
103 ``printf ("Version: %u.%u.%u\\n",``
104
105 ``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
106 * - __u32
107 - ``capabilities``
108 - Available capabilities of the physical device as a whole, see
109 :ref:`device-capabilities`. The same physical device can export
110 multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and
111 /dev/radioZ). The ``capabilities`` field should contain a union of
112 all capabilities available around the several V4L2 devices
113 exported to userspace. For all those devices the ``capabilities``
114 field returns the same set of capabilities. This allows
115 applications to open just one of the devices (typically the video
116 device) and discover whether video, vbi and/or radio are also
117 supported.
118 * - __u32
119 - ``device_caps``
120 - Device capabilities of the opened device, see
121 :ref:`device-capabilities`. Should contain the available
122 capabilities of that specific device node. So, for example,
123 ``device_caps`` of a radio device will only contain radio related
124 capabilities and no video or vbi capabilities. This field is only
125 set if the ``capabilities`` field contains the
126 ``V4L2_CAP_DEVICE_CAPS`` capability. Only the ``capabilities``
127 field can have the ``V4L2_CAP_DEVICE_CAPS`` capability,
128 ``device_caps`` will never set ``V4L2_CAP_DEVICE_CAPS``.
129 * - __u32
130 - ``reserved``\ [3]
131 - Reserved for future extensions. Drivers must set this array to
132 zero.
133
134
135 .. tabularcolumns:: |p{7.0cm}|p{2.6cm}|p{7.7cm}|
136
137 .. _device-capabilities:
138
139 .. cssclass:: longtable
140
141 .. flat-table:: Device Capabilities Flags
142 :header-rows: 0
143 :stub-columns: 0
144 :widths: 3 1 4
145
146 * - ``V4L2_CAP_VIDEO_CAPTURE``
147 - 0x00000001
148 - The device supports the single-planar API through the
149 :ref:`Video Capture <capture>` interface.
150 * - ``V4L2_CAP_VIDEO_CAPTURE_MPLANE``
151 - 0x00001000
152 - The device supports the :ref:`multi-planar API <planar-apis>`
153 through the :ref:`Video Capture <capture>` interface.
154 * - ``V4L2_CAP_VIDEO_OUTPUT``
155 - 0x00000002
156 - The device supports the single-planar API through the
157 :ref:`Video Output <output>` interface.
158 * - ``V4L2_CAP_VIDEO_OUTPUT_MPLANE``
159 - 0x00002000
160 - The device supports the :ref:`multi-planar API <planar-apis>`
161 through the :ref:`Video Output <output>` interface.
162 * - ``V4L2_CAP_VIDEO_M2M``
163 - 0x00008000
164 - The device supports the single-planar API through the Video
165 Memory-To-Memory interface.
166 * - ``V4L2_CAP_VIDEO_M2M_MPLANE``
167 - 0x00004000
168 - The device supports the :ref:`multi-planar API <planar-apis>`
169 through the Video Memory-To-Memory interface.
170 * - ``V4L2_CAP_VIDEO_OVERLAY``
171 - 0x00000004
172 - The device supports the :ref:`Video Overlay <overlay>`
173 interface. A video overlay device typically stores captured images
174 directly in the video memory of a graphics card, with hardware
175 clipping and scaling.
176 * - ``V4L2_CAP_VBI_CAPTURE``
177 - 0x00000010
178 - The device supports the :ref:`Raw VBI Capture <raw-vbi>`
179 interface, providing Teletext and Closed Caption data.
180 * - ``V4L2_CAP_VBI_OUTPUT``
181 - 0x00000020
182 - The device supports the :ref:`Raw VBI Output <raw-vbi>`
183 interface.
184 * - ``V4L2_CAP_SLICED_VBI_CAPTURE``
185 - 0x00000040
186 - The device supports the :ref:`Sliced VBI Capture <sliced>`
187 interface.
188 * - ``V4L2_CAP_SLICED_VBI_OUTPUT``
189 - 0x00000080
190 - The device supports the :ref:`Sliced VBI Output <sliced>`
191 interface.
192 * - ``V4L2_CAP_RDS_CAPTURE``
193 - 0x00000100
194 - The device supports the :ref:`RDS <rds>` capture interface.
195 * - ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY``
196 - 0x00000200
197 - The device supports the :ref:`Video Output Overlay <osd>` (OSD)
198 interface. Unlike the *Video Overlay* interface, this is a
199 secondary function of video output devices and overlays an image
200 onto an outgoing video signal. When the driver sets this flag, it
201 must clear the ``V4L2_CAP_VIDEO_OVERLAY`` flag and vice
202 versa. [#f1]_
203 * - ``V4L2_CAP_HW_FREQ_SEEK``
204 - 0x00000400
205 - The device supports the
206 :ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl
207 for hardware frequency seeking.
208 * - ``V4L2_CAP_RDS_OUTPUT``
209 - 0x00000800
210 - The device supports the :ref:`RDS <rds>` output interface.
211 * - ``V4L2_CAP_TUNER``
212 - 0x00010000
213 - The device has some sort of tuner to receive RF-modulated video
214 signals. For more information about tuner programming see
215 :ref:`tuner`.
216 * - ``V4L2_CAP_AUDIO``
217 - 0x00020000
218 - The device has audio inputs or outputs. It may or may not support
219 audio recording or playback, in PCM or compressed formats. PCM
220 audio support must be implemented as ALSA or OSS interface. For
221 more information on audio inputs and outputs see :ref:`audio`.
222 * - ``V4L2_CAP_RADIO``
223 - 0x00040000
224 - This is a radio receiver.
225 * - ``V4L2_CAP_MODULATOR``
226 - 0x00080000
227 - The device has some sort of modulator to emit RF-modulated
228 video/audio signals. For more information about modulator
229 programming see :ref:`tuner`.
230 * - ``V4L2_CAP_SDR_CAPTURE``
231 - 0x00100000
232 - The device supports the :ref:`SDR Capture <sdr>` interface.
233 * - ``V4L2_CAP_EXT_PIX_FORMAT``
234 - 0x00200000
235 - The device supports the struct
236 :c:type:`v4l2_pix_format` extended fields.
237 * - ``V4L2_CAP_SDR_OUTPUT``
238 - 0x00400000
239 - The device supports the :ref:`SDR Output <sdr>` interface.
240 * - ``V4L2_CAP_META_CAPTURE``
241 - 0x00800000
242 - The device supports the :ref:`metadata` capture interface.
243 * - ``V4L2_CAP_READWRITE``
244 - 0x01000000
245 - The device supports the :c:func:`read()` and/or
246 :c:func:`write()` I/O methods.
247 * - ``V4L2_CAP_EDID``
248 - 0x02000000
249 - The device stores the EDID for a video input, or retrieves the EDID for a video
250 output. It is a standalone EDID device, so no video streaming etc. will take place.
251
252 For a video input this is typically an eeprom that supports the
253 :ref:`VESA Enhanced Display Data Channel Standard <vesaeddc>`. It can be something
254 else as well, for example a micro controller.
255
256 For a video output this is typically read from an external device such as an
257 HDMI splitter accessed by a serial port.
258 * - ``V4L2_CAP_STREAMING``
259 - 0x04000000
260 - The device supports the :ref:`streaming <mmap>` I/O method.
261 * - ``V4L2_CAP_META_OUTPUT``
262 - 0x08000000
263 - The device supports the :ref:`metadata` output interface.
264 * - ``V4L2_CAP_TOUCH``
265 - 0x10000000
266 - This is a touch device.
267 * - ``V4L2_CAP_IO_MC``
268 - 0x20000000
269 - There is only one input and/or output seen from userspace. The whole
270 video topology configuration, including which I/O entity is routed to
271 the input/output, is configured by userspace via the Media Controller.
272 See :ref:`media_controller`.
273 * - ``V4L2_CAP_DEVICE_CAPS``
274 - 0x80000000
275 - The driver fills the ``device_caps`` field. This capability can
276 only appear in the ``capabilities`` field and never in the
277 ``device_caps`` field.
278
279 Return Value
280 ============
281
282 On success 0 is returned, on error -1 and the ``errno`` variable is set
283 appropriately. The generic error codes are described at the
284 :ref:`Generic Error Codes <gen-errors>` chapter.
285
286 .. [#f1]
287 The struct :c:type:`v4l2_framebuffer` lacks an
288 enum :c:type:`v4l2_buf_type` field, therefore the
289 type of overlay is implied by the driver capabilities.
290

3. 한국어 전문 번역

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

장치 capability 조회

1-40

모든 V4L2 장치는 `VIDIOC_QUERYCAP`을 지원합니다. 이 명령은 해당 kernel device가 V4L2 명세와 호환되는지 식별하고 드라이버·하드웨어 기능을 `struct v4l2_capability`에 반환합니다.

드라이버가 이 명세와 호환되지 않으면 `EINVAL`을 반환합니다. `fd`는 열린 장치 파일이고 `argp`는 드라이버가 채울 capability 구조체 포인터입니다.

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

.. _VIDIOC_QUERYCAP:

*********************
ioctl VIDIOC_QUERYCAP
*********************

Name
====

VIDIOC_QUERYCAP - Query device capabilities

Synopsis
========

.. c:macro:: VIDIOC_QUERYCAP

``int ioctl(int fd, VIDIOC_QUERYCAP, struct v4l2_capability *argp)``

Arguments
=========

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

``argp``
    Pointer to struct :c:type:`v4l2_capability`.

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

All V4L2 devices support the ``VIDIOC_QUERYCAP`` ioctl. It is used to
identify kernel devices compatible with this specification and to obtain
information about driver and hardware capabilities. The ioctl takes a
pointer to a struct :c:type:`v4l2_capability` which is
filled by the driver. When the driver is not compatible with this
specification the ioctl returns an ``EINVAL`` error code.

struct v4l2_capability

41-136
장치 식별 필드
필드형식내용
`driver[16]`NUL 종료 ASCII고유 드라이버 이름. 예: `bttv`; 드라이버 확인·알려진 bug 우회·오류 보고에 사용
`card[32]`NUL 종료 UTF-8사용자 표시용 장치 이름. 같은 모델 여러 개는 device path나 `bus_info`와 조합
`bus_info[32]`NUL 종료 ASCII시스템 내 위치. 동일 장치 구분용
`version``__u32`V4L2 subsystem의 kernel 형식 버전

고정 길이 문자열은 배열 경계를 넘지 않게 읽고 쓰며 반드시 NUL 종료를 보장해야 합니다.

bus_info 접두사
장치 종류접두사
PCI`PCI:`
PCI Express`PCIe:`
USB`usb-`
I2C`I2C:`
ISA`ISA:`
parallel port`parport`
platform`platform:`

Bus 종류를 문자열 접두사로 구분합니다.

위치 정보가 없으면 드라이버가 제어하는 장치를 `platform:vivid-000`처럼 번호로 구분합니다.

Kernel 3.1부터 `version`은 kernel numbering scheme을 따르는 V4L2 subsystem 버전입니다. Stable·배포판 kernel이 더 새 V4L2 stack을 가져오면 실행 kernel 버전과 반드시 같지는 않습니다.

KERNEL_VERSION 인코딩
비트
23..16major `a`
15..8minor `b`
7..0patch `c`

`KERNEL_VERSION(a,b,c)`는 세 구성요소를 32비트 값에 배치합니다.

예를 들어 V4L2 4.14 stack은 `KERNEL_VERSION(4, 14, 0)`이며, 각각 `(version >> 16) & 0xFF`, `(version >> 8) & 0xFF`, `version & 0xFF`로 출력할 수 있습니다.

Capability 집합 필드
필드범위
`capabilities`물리 장치가 `/dev/videoX`, `/dev/vbiY`, `/dev/radioZ` 등으로 내보내는 모든 V4L2 node 기능의 합집합. 같은 물리 장치의 모든 node에서 동일
`device_caps`현재 열린 특정 device node의 기능만 포함. `capabilities`에 `V4L2_CAP_DEVICE_CAPS`가 있을 때만 유효
`reserved[3]`향후 확장용. 드라이버가 모두 0으로 설정

물리 장치 전체와 현재 열린 node의 기능 범위를 구분합니다.

`V4L2_CAP_DEVICE_CAPS` 자체는 `capabilities`에만 나타나며 `device_caps`에는 절대로 나타나지 않습니다.

.. c:type:: v4l2_capability

.. tabularcolumns:: |p{1.4cm}|p{2.8cm}|p{13.1cm}|

.. cssclass:: longtable

.. flat-table:: struct v4l2_capability
    :header-rows:  0
    :stub-columns: 0
    :widths:       3 4 20

    * - __u8
      - ``driver``\ [16]
      - Name of the driver, a unique NUL-terminated ASCII string. For
	example: "bttv". Driver specific applications can use this
	information to verify the driver identity. It is also useful to
	work around known bugs, or to identify drivers in error reports.

	Storing strings in fixed sized arrays is bad practice but
	unavoidable here. Drivers and applications should take precautions
	to never read or write beyond the end of the array and to make
	sure the strings are properly NUL-terminated.
    * - __u8
      - ``card``\ [32]
      - Name of the device, a NUL-terminated UTF-8 string. For example:
	"Yoyodyne TV/FM". One driver may support different brands or
	models of video hardware. This information is intended for users,
	for example in a menu of available devices. Since multiple TV
	cards of the same brand may be installed which are supported by
	the same driver, this name should be combined with the character
	device file name (e. g. ``/dev/video2``) or the ``bus_info``
	string to avoid ambiguities.
    * - __u8
      - ``bus_info``\ [32]
      - Location of the device in the system, a NUL-terminated ASCII
	string. For example: "PCI:0000:05:06.0". This information is
	intended for users, to distinguish multiple identical devices. If
	no such information is available the field must simply count the
	devices controlled by the driver ("platform:vivid-000"). The
	bus_info must start with "PCI:" for PCI boards, "PCIe:" for PCI
	Express boards, "usb-" for USB devices, "I2C:" for i2c devices,
	"ISA:" for ISA devices, "parport" for parallel port devices and
	"platform:" for platform devices.
    * - __u32
      - ``version``
      - Version number of the driver.

	Starting with kernel 3.1, the version reported is provided by the
	V4L2 subsystem following the kernel numbering scheme. However, it
	may not always return the same version as the kernel if, for
	example, a stable or distribution-modified kernel uses the V4L2
	stack from a newer kernel.

	The version number is formatted using the ``KERNEL_VERSION()``
	macro. For example if the media stack corresponds to the V4L2
	version shipped with Kernel 4.14, it would be equivalent to:
    * - :cspan:`2`

	``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``

	``__u32 version = KERNEL_VERSION(4, 14, 0);``

	``printf ("Version: %u.%u.%u\\n",``

	``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
    * - __u32
      - ``capabilities``
      - Available capabilities of the physical device as a whole, see
	:ref:`device-capabilities`. The same physical device can export
	multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and
	/dev/radioZ). The ``capabilities`` field should contain a union of
	all capabilities available around the several V4L2 devices
	exported to userspace. For all those devices the ``capabilities``
	field returns the same set of capabilities. This allows
	applications to open just one of the devices (typically the video
	device) and discover whether video, vbi and/or radio are also
	supported.
    * - __u32
      - ``device_caps``
      - Device capabilities of the opened device, see
	:ref:`device-capabilities`. Should contain the available
	capabilities of that specific device node. So, for example,
	``device_caps`` of a radio device will only contain radio related
	capabilities and no video or vbi capabilities. This field is only
	set if the ``capabilities`` field contains the
	``V4L2_CAP_DEVICE_CAPS`` capability. Only the ``capabilities``
	field can have the ``V4L2_CAP_DEVICE_CAPS`` capability,
	``device_caps`` will never set ``V4L2_CAP_DEVICE_CAPS``.
    * - __u32
      - ``reserved``\ [3]
      - Reserved for future extensions. Drivers must set this array to
	zero.


.. tabularcolumns:: |p{7.0cm}|p{2.6cm}|p{7.7cm}|

Device capability 플래그

137-278
Video capture·output 기능
상수기능
`V4L2_CAP_VIDEO_CAPTURE``0x00000001`single-planar video capture
`V4L2_CAP_VIDEO_CAPTURE_MPLANE``0x00001000`multi-planar video capture
`V4L2_CAP_VIDEO_OUTPUT``0x00000002`single-planar video output
`V4L2_CAP_VIDEO_OUTPUT_MPLANE``0x00002000`multi-planar video output
`V4L2_CAP_VIDEO_M2M``0x00008000`single-planar memory-to-memory
`V4L2_CAP_VIDEO_M2M_MPLANE``0x00004000`multi-planar memory-to-memory
`V4L2_CAP_VIDEO_OVERLAY``0x00000004`capture 영상을 graphics card video memory에 직접 저장하는 clipping·scaling overlay
`V4L2_CAP_VIDEO_OUTPUT_OVERLAY``0x00000200`출력 영상에 이미지를 겹치는 OSD. `VIDEO_OVERLAY`와 상호 배타

Single-planar, multi-planar, memory-to-memory와 overlay 인터페이스를 구분합니다.

`v4l2_framebuffer`에는 `v4l2_buf_type` 필드가 없으므로 overlay 종류는 드라이버 capability로 암시됩니다. 따라서 드라이버는 두 overlay flag 가운데 하나를 설정하면 다른 하나를 지워야 합니다.

VBI·RDS·RF·audio 기능
상수기능
`V4L2_CAP_VBI_CAPTURE``0x00000010`Teletext·Closed Caption을 제공하는 raw VBI capture
`V4L2_CAP_VBI_OUTPUT``0x00000020`raw VBI output
`V4L2_CAP_SLICED_VBI_CAPTURE``0x00000040`sliced VBI capture
`V4L2_CAP_SLICED_VBI_OUTPUT``0x00000080`sliced VBI output
`V4L2_CAP_RDS_CAPTURE``0x00000100`RDS capture
`V4L2_CAP_RDS_OUTPUT``0x00000800`RDS output
`V4L2_CAP_HW_FREQ_SEEK``0x00000400``VIDIOC_S_HW_FREQ_SEEK` hardware 주파수 탐색
`V4L2_CAP_TUNER``0x00010000`RF 변조 영상 수신 tuner
`V4L2_CAP_AUDIO``0x00020000`audio input/output. PCM은 ALSA 또는 OSS로 구현
`V4L2_CAP_RADIO``0x00040000`radio receiver
`V4L2_CAP_MODULATOR``0x00080000`RF 변조 video/audio 송출 modulator

방송 보조 데이터와 RF 장치 기능입니다.

SDR·pixel·metadata 기능
상수기능
`V4L2_CAP_SDR_CAPTURE``0x00100000`SDR capture
`V4L2_CAP_EXT_PIX_FORMAT``0x00200000``v4l2_pix_format` 확장 필드 지원
`V4L2_CAP_SDR_OUTPUT``0x00400000`SDR output
`V4L2_CAP_META_CAPTURE``0x00800000`metadata capture
`V4L2_CAP_META_OUTPUT``0x08000000`metadata output

전용 데이터 형식과 metadata 방향입니다.

I/O·독립 장치·topology 기능
상수기능
`V4L2_CAP_READWRITE``0x01000000``read()` 또는 `write()` I/O
`V4L2_CAP_EDID``0x02000000`입력 EDID 저장 또는 출력 EDID 검색 전용 장치. 자체 streaming은 없음
`V4L2_CAP_STREAMING``0x04000000`streaming I/O
`V4L2_CAP_TOUCH``0x10000000`touch 장치
`V4L2_CAP_IO_MC``0x20000000`사용자 공간에는 input/output 하나만 보이고 전체 routing topology는 Media Controller로 구성
`V4L2_CAP_DEVICE_CAPS``0x80000000`드라이버가 `device_caps`를 채움. `capabilities`에만 설정 가능

사용 가능한 I/O 방식과 Media Controller 소유 topology를 나타냅니다.

EDID input 장치는 보통 VESA Enhanced Display Data Channel을 지원하는 EEPROM이지만 microcontroller일 수도 있습니다. Output EDID는 serial port로 접근하는 HDMI splitter 같은 외부 장치에서 읽을 수 있습니다.

.. _device-capabilities:

.. cssclass:: longtable

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

    * - ``V4L2_CAP_VIDEO_CAPTURE``
      - 0x00000001
      - The device supports the single-planar API through the
	:ref:`Video Capture <capture>` interface.
    * - ``V4L2_CAP_VIDEO_CAPTURE_MPLANE``
      - 0x00001000
      - The device supports the :ref:`multi-planar API <planar-apis>`
	through the :ref:`Video Capture <capture>` interface.
    * - ``V4L2_CAP_VIDEO_OUTPUT``
      - 0x00000002
      - The device supports the single-planar API through the
	:ref:`Video Output <output>` interface.
    * - ``V4L2_CAP_VIDEO_OUTPUT_MPLANE``
      - 0x00002000
      - The device supports the :ref:`multi-planar API <planar-apis>`
	through the :ref:`Video Output <output>` interface.
    * - ``V4L2_CAP_VIDEO_M2M``
      - 0x00008000
      - The device supports the single-planar API through the Video
	Memory-To-Memory interface.
    * - ``V4L2_CAP_VIDEO_M2M_MPLANE``
      - 0x00004000
      - The device supports the :ref:`multi-planar API <planar-apis>`
	through the Video Memory-To-Memory interface.
    * - ``V4L2_CAP_VIDEO_OVERLAY``
      - 0x00000004
      - The device supports the :ref:`Video Overlay <overlay>`
	interface. A video overlay device typically stores captured images
	directly in the video memory of a graphics card, with hardware
	clipping and scaling.
    * - ``V4L2_CAP_VBI_CAPTURE``
      - 0x00000010
      - The device supports the :ref:`Raw VBI Capture <raw-vbi>`
	interface, providing Teletext and Closed Caption data.
    * - ``V4L2_CAP_VBI_OUTPUT``
      - 0x00000020
      - The device supports the :ref:`Raw VBI Output <raw-vbi>`
	interface.
    * - ``V4L2_CAP_SLICED_VBI_CAPTURE``
      - 0x00000040
      - The device supports the :ref:`Sliced VBI Capture <sliced>`
	interface.
    * - ``V4L2_CAP_SLICED_VBI_OUTPUT``
      - 0x00000080
      - The device supports the :ref:`Sliced VBI Output <sliced>`
	interface.
    * - ``V4L2_CAP_RDS_CAPTURE``
      - 0x00000100
      - The device supports the :ref:`RDS <rds>` capture interface.
    * - ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY``
      - 0x00000200
      - The device supports the :ref:`Video Output Overlay <osd>` (OSD)
	interface. Unlike the *Video Overlay* interface, this is a
	secondary function of video output devices and overlays an image
	onto an outgoing video signal. When the driver sets this flag, it
	must clear the ``V4L2_CAP_VIDEO_OVERLAY`` flag and vice
	versa. [#f1]_
    * - ``V4L2_CAP_HW_FREQ_SEEK``
      - 0x00000400
      - The device supports the
	:ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl
	for hardware frequency seeking.
    * - ``V4L2_CAP_RDS_OUTPUT``
      - 0x00000800
      - The device supports the :ref:`RDS <rds>` output interface.
    * - ``V4L2_CAP_TUNER``
      - 0x00010000
      - The device has some sort of tuner to receive RF-modulated video
	signals. For more information about tuner programming see
	:ref:`tuner`.
    * - ``V4L2_CAP_AUDIO``
      - 0x00020000
      - The device has audio inputs or outputs. It may or may not support
	audio recording or playback, in PCM or compressed formats. PCM
	audio support must be implemented as ALSA or OSS interface. For
	more information on audio inputs and outputs see :ref:`audio`.
    * - ``V4L2_CAP_RADIO``
      - 0x00040000
      - This is a radio receiver.
    * - ``V4L2_CAP_MODULATOR``
      - 0x00080000
      - The device has some sort of modulator to emit RF-modulated
	video/audio signals. For more information about modulator
	programming see :ref:`tuner`.
    * - ``V4L2_CAP_SDR_CAPTURE``
      - 0x00100000
      - The device supports the :ref:`SDR Capture <sdr>` interface.
    * - ``V4L2_CAP_EXT_PIX_FORMAT``
      - 0x00200000
      - The device supports the struct
	:c:type:`v4l2_pix_format` extended fields.
    * - ``V4L2_CAP_SDR_OUTPUT``
      - 0x00400000
      - The device supports the :ref:`SDR Output <sdr>` interface.
    * - ``V4L2_CAP_META_CAPTURE``
      - 0x00800000
      - The device supports the :ref:`metadata` capture interface.
    * - ``V4L2_CAP_READWRITE``
      - 0x01000000
      - The device supports the :c:func:`read()` and/or
	:c:func:`write()` I/O methods.
    * - ``V4L2_CAP_EDID``
      - 0x02000000
      - The device stores the EDID for a video input, or retrieves the EDID for a video
        output. It is a standalone EDID device, so no video streaming etc. will take place.

        For a video input this is typically an eeprom that supports the
        :ref:`VESA Enhanced Display Data Channel Standard <vesaeddc>`. It can be something
        else as well, for example a micro controller.

        For a video output this is typically read from an external device such as an
        HDMI splitter accessed by a serial port.
    * - ``V4L2_CAP_STREAMING``
      - 0x04000000
      - The device supports the :ref:`streaming <mmap>` I/O method.
    * - ``V4L2_CAP_META_OUTPUT``
      - 0x08000000
      - The device supports the :ref:`metadata` output interface.
    * - ``V4L2_CAP_TOUCH``
      - 0x10000000
      - This is a touch device.
    * - ``V4L2_CAP_IO_MC``
      - 0x20000000
      - There is only one input and/or output seen from userspace. The whole
        video topology configuration, including which I/O entity is routed to
        the input/output, is configured by userspace via the Media Controller.
        See :ref:`media_controller`.
    * - ``V4L2_CAP_DEVICE_CAPS``
      - 0x80000000
      - The driver fills the ``device_caps`` field. This capability can
	only appear in the ``capabilities`` field and never in the
	``device_caps`` field.

반환값과 overlay 각주

279-289

성공하면 0, 오류이면 -1을 반환하고 `errno`를 설정합니다. 명세와 호환되지 않는 장치는 `EINVAL`일 수 있습니다.

Overlay type은 `v4l2_framebuffer` 구조체에 명시 필드가 없으므로 `V4L2_CAP_VIDEO_OVERLAY` 또는 `V4L2_CAP_VIDEO_OUTPUT_OVERLAY` capability로 판별합니다.

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.

.. [#f1]
   The struct :c:type:`v4l2_framebuffer` lacks an
   enum :c:type:`v4l2_buf_type` field, therefore the
   type of overlay is implied by the driver capabilities.