1 .. -*- coding: utf-8; mode: rst -*-
12 VIDIOC_QUERYCAP - Query device capabilities
18 .. c:function:: int ioctl( int fd, VIDIOC_QUERYCAP, struct v4l2_capability *argp )
19 :name: VIDIOC_QUERYCAP
26 File descriptor returned by :ref:`open() <func-open>`.
29 Pointer to struct :c:type:`v4l2_capability`.
35 All V4L2 devices support the ``VIDIOC_QUERYCAP`` ioctl. It is used to
36 identify kernel devices compatible with this specification and to obtain
37 information about driver and hardware capabilities. The ioctl takes a
38 pointer to a struct :c:type:`v4l2_capability` which is
39 filled by the driver. When the driver is not compatible with this
40 specification the ioctl returns an ``EINVAL`` error code.
43 .. tabularcolumns:: |p{1.5cm}|p{2.5cm}|p{13cm}|
45 .. c:type:: v4l2_capability
47 .. flat-table:: struct v4l2_capability
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.
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.
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.
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:vivi-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.
86 - Version number of the driver.
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.
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:
99 ``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
101 ``__u32 version = KERNEL_VERSION(4, 14, 0);``
103 ``printf ("Version: %u.%u.%u\\n",``
105 ``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
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
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``.
131 - Reserved for future extensions. Drivers must set this array to
136 .. tabularcolumns:: |p{6.1cm}|p{2.2cm}|p{8.7cm}|
138 .. _device-capabilities:
140 .. cssclass:: longtable
142 .. flat-table:: Device Capabilities Flags
147 * - ``V4L2_CAP_VIDEO_CAPTURE``
149 - The device supports the single-planar API through the
150 :ref:`Video Capture <capture>` interface.
151 * - ``V4L2_CAP_VIDEO_CAPTURE_MPLANE``
153 - The device supports the :ref:`multi-planar API <planar-apis>`
154 through the :ref:`Video Capture <capture>` interface.
155 * - ``V4L2_CAP_VIDEO_OUTPUT``
157 - The device supports the single-planar API through the
158 :ref:`Video Output <output>` interface.
159 * - ``V4L2_CAP_VIDEO_OUTPUT_MPLANE``
161 - The device supports the :ref:`multi-planar API <planar-apis>`
162 through the :ref:`Video Output <output>` interface.
163 * - ``V4L2_CAP_VIDEO_M2M``
165 - The device supports the single-planar API through the Video
166 Memory-To-Memory interface.
167 * - ``V4L2_CAP_VIDEO_M2M_MPLANE``
169 - The device supports the :ref:`multi-planar API <planar-apis>`
170 through the Video Memory-To-Memory interface.
171 * - ``V4L2_CAP_VIDEO_OVERLAY``
173 - The device supports the :ref:`Video Overlay <overlay>`
174 interface. A video overlay device typically stores captured images
175 directly in the video memory of a graphics card, with hardware
176 clipping and scaling.
177 * - ``V4L2_CAP_VBI_CAPTURE``
179 - The device supports the :ref:`Raw VBI Capture <raw-vbi>`
180 interface, providing Teletext and Closed Caption data.
181 * - ``V4L2_CAP_VBI_OUTPUT``
183 - The device supports the :ref:`Raw VBI Output <raw-vbi>`
185 * - ``V4L2_CAP_SLICED_VBI_CAPTURE``
187 - The device supports the :ref:`Sliced VBI Capture <sliced>`
189 * - ``V4L2_CAP_SLICED_VBI_OUTPUT``
191 - The device supports the :ref:`Sliced VBI Output <sliced>`
193 * - ``V4L2_CAP_RDS_CAPTURE``
195 - The device supports the :ref:`RDS <rds>` capture interface.
196 * - ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY``
198 - The device supports the :ref:`Video Output Overlay <osd>` (OSD)
199 interface. Unlike the *Video Overlay* interface, this is a
200 secondary function of video output devices and overlays an image
201 onto an outgoing video signal. When the driver sets this flag, it
202 must clear the ``V4L2_CAP_VIDEO_OVERLAY`` flag and vice
204 * - ``V4L2_CAP_HW_FREQ_SEEK``
206 - The device supports the
207 :ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl
208 for hardware frequency seeking.
209 * - ``V4L2_CAP_RDS_OUTPUT``
211 - The device supports the :ref:`RDS <rds>` output interface.
212 * - ``V4L2_CAP_TUNER``
214 - The device has some sort of tuner to receive RF-modulated video
215 signals. For more information about tuner programming see
217 * - ``V4L2_CAP_AUDIO``
219 - The device has audio inputs or outputs. It may or may not support
220 audio recording or playback, in PCM or compressed formats. PCM
221 audio support must be implemented as ALSA or OSS interface. For
222 more information on audio inputs and outputs see :ref:`audio`.
223 * - ``V4L2_CAP_RADIO``
225 - This is a radio receiver.
226 * - ``V4L2_CAP_MODULATOR``
228 - The device has some sort of modulator to emit RF-modulated
229 video/audio signals. For more information about modulator
230 programming see :ref:`tuner`.
231 * - ``V4L2_CAP_SDR_CAPTURE``
233 - The device supports the :ref:`SDR Capture <sdr>` interface.
234 * - ``V4L2_CAP_EXT_PIX_FORMAT``
236 - The device supports the struct
237 :c:type:`v4l2_pix_format` extended fields.
238 * - ``V4L2_CAP_SDR_OUTPUT``
240 - The device supports the :ref:`SDR Output <sdr>` interface.
241 * - ``V4L2_CAP_META_CAPTURE``
243 - The device supports the :ref:`metadata` capture interface.
244 * - ``V4L2_CAP_READWRITE``
246 - The device supports the :ref:`read() <rw>` and/or
247 :ref:`write() <rw>` I/O methods.
248 * - ``V4L2_CAP_ASYNCIO``
250 - The device supports the :ref:`asynchronous <async>` I/O methods.
251 * - ``V4L2_CAP_STREAMING``
253 - The device supports the :ref:`streaming <mmap>` I/O method.
254 * - ``V4L2_CAP_TOUCH``
256 - This is a touch device.
257 * - ``V4L2_CAP_DEVICE_CAPS``
259 - The driver fills the ``device_caps`` field. This capability can
260 only appear in the ``capabilities`` field and never in the
261 ``device_caps`` field.
267 On success 0 is returned, on error -1 and the ``errno`` variable is set
268 appropriately. The generic error codes are described at the
269 :ref:`Generic Error Codes <gen-errors>` chapter.
272 The struct :c:type:`v4l2_framebuffer` lacks an
273 enum :c:type:`v4l2_buf_type` field, therefore the
274 type of overlay is implied by the driver capabilities.