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>`.
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.
42 .. tabularcolumns:: |p{1.5cm}|p{2.5cm}|p{13cm}|
44 .. c:type:: v4l2_capability
46 .. flat-table:: struct v4l2_capability
53 - Name of the driver, a unique NUL-terminated ASCII string. For
54 example: "bttv". Driver specific applications can use this
55 information to verify the driver identity. It is also useful to
56 work around known bugs, or to identify drivers in error reports.
58 Storing strings in fixed sized arrays is bad practice but
59 unavoidable here. Drivers and applications should take precautions
60 to never read or write beyond the end of the array and to make
61 sure the strings are properly NUL-terminated.
64 - Name of the device, a NUL-terminated UTF-8 string. For example:
65 "Yoyodyne TV/FM". One driver may support different brands or
66 models of video hardware. This information is intended for users,
67 for example in a menu of available devices. Since multiple TV
68 cards of the same brand may be installed which are supported by
69 the same driver, this name should be combined with the character
70 device file name (e. g. ``/dev/video2``) or the ``bus_info``
71 string to avoid ambiguities.
74 - Location of the device in the system, a NUL-terminated ASCII
75 string. For example: "PCI:0000:05:06.0". This information is
76 intended for users, to distinguish multiple identical devices. If
77 no such information is available the field must simply count the
78 devices controlled by the driver ("platform:vivi-000"). The
79 bus_info must start with "PCI:" for PCI boards, "PCIe:" for PCI
80 Express boards, "usb-" for USB devices, "I2C:" for i2c devices,
81 "ISA:" for ISA devices, "parport" for parallel port devices and
82 "platform:" for platform devices.
85 - Version number of the driver.
87 Starting with kernel 3.1, the version reported is provided by the
88 V4L2 subsystem following the kernel numbering scheme. However, it
89 may not always return the same version as the kernel if, for
90 example, a stable or distribution-modified kernel uses the V4L2
91 stack from a newer kernel.
93 The version number is formatted using the ``KERNEL_VERSION()``
97 ``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
99 ``__u32 version = KERNEL_VERSION(0, 8, 1);``
101 ``printf ("Version: %u.%u.%u\\n",``
103 ``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
106 - Available capabilities of the physical device as a whole, see
107 :ref:`device-capabilities`. The same physical device can export
108 multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and
109 /dev/radioZ). The ``capabilities`` field should contain a union of
110 all capabilities available around the several V4L2 devices
111 exported to userspace. For all those devices the ``capabilities``
112 field returns the same set of capabilities. This allows
113 applications to open just one of the devices (typically the video
114 device) and discover whether video, vbi and/or radio are also
118 - Device capabilities of the opened device, see
119 :ref:`device-capabilities`. Should contain the available
120 capabilities of that specific device node. So, for example,
121 ``device_caps`` of a radio device will only contain radio related
122 capabilities and no video or vbi capabilities. This field is only
123 set if the ``capabilities`` field contains the
124 ``V4L2_CAP_DEVICE_CAPS`` capability. Only the ``capabilities``
125 field can have the ``V4L2_CAP_DEVICE_CAPS`` capability,
126 ``device_caps`` will never set ``V4L2_CAP_DEVICE_CAPS``.
129 - Reserved for future extensions. Drivers must set this array to
134 .. tabularcolumns:: |p{6cm}|p{2.2cm}|p{8.8cm}|
136 .. _device-capabilities:
138 .. cssclass:: longtable
140 .. flat-table:: Device Capabilities Flags
145 * - ``V4L2_CAP_VIDEO_CAPTURE``
147 - The device supports the single-planar API through the
148 :ref:`Video Capture <capture>` interface.
149 * - ``V4L2_CAP_VIDEO_CAPTURE_MPLANE``
151 - The device supports the :ref:`multi-planar API <planar-apis>`
152 through the :ref:`Video Capture <capture>` interface.
153 * - ``V4L2_CAP_VIDEO_OUTPUT``
155 - The device supports the single-planar API through the
156 :ref:`Video Output <output>` interface.
157 * - ``V4L2_CAP_VIDEO_OUTPUT_MPLANE``
159 - The device supports the :ref:`multi-planar API <planar-apis>`
160 through the :ref:`Video Output <output>` interface.
161 * - ``V4L2_CAP_VIDEO_M2M``
163 - The device supports the single-planar API through the Video
164 Memory-To-Memory interface.
165 * - ``V4L2_CAP_VIDEO_M2M_MPLANE``
167 - The device supports the :ref:`multi-planar API <planar-apis>`
168 through the Video Memory-To-Memory interface.
169 * - ``V4L2_CAP_VIDEO_OVERLAY``
171 - The device supports the :ref:`Video Overlay <overlay>`
172 interface. A video overlay device typically stores captured images
173 directly in the video memory of a graphics card, with hardware
174 clipping and scaling.
175 * - ``V4L2_CAP_VBI_CAPTURE``
177 - The device supports the :ref:`Raw VBI Capture <raw-vbi>`
178 interface, providing Teletext and Closed Caption data.
179 * - ``V4L2_CAP_VBI_OUTPUT``
181 - The device supports the :ref:`Raw VBI Output <raw-vbi>`
183 * - ``V4L2_CAP_SLICED_VBI_CAPTURE``
185 - The device supports the :ref:`Sliced VBI Capture <sliced>`
187 * - ``V4L2_CAP_SLICED_VBI_OUTPUT``
189 - The device supports the :ref:`Sliced VBI Output <sliced>`
191 * - ``V4L2_CAP_RDS_CAPTURE``
193 - The device supports the :ref:`RDS <rds>` capture interface.
194 * - ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY``
196 - The device supports the :ref:`Video Output Overlay <osd>` (OSD)
197 interface. Unlike the *Video Overlay* interface, this is a
198 secondary function of video output devices and overlays an image
199 onto an outgoing video signal. When the driver sets this flag, it
200 must clear the ``V4L2_CAP_VIDEO_OVERLAY`` flag and vice
202 * - ``V4L2_CAP_HW_FREQ_SEEK``
204 - The device supports the
205 :ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl
206 for hardware frequency seeking.
207 * - ``V4L2_CAP_RDS_OUTPUT``
209 - The device supports the :ref:`RDS <rds>` output interface.
210 * - ``V4L2_CAP_TUNER``
212 - The device has some sort of tuner to receive RF-modulated video
213 signals. For more information about tuner programming see
215 * - ``V4L2_CAP_AUDIO``
217 - The device has audio inputs or outputs. It may or may not support
218 audio recording or playback, in PCM or compressed formats. PCM
219 audio support must be implemented as ALSA or OSS interface. For
220 more information on audio inputs and outputs see :ref:`audio`.
221 * - ``V4L2_CAP_RADIO``
223 - This is a radio receiver.
224 * - ``V4L2_CAP_MODULATOR``
226 - The device has some sort of modulator to emit RF-modulated
227 video/audio signals. For more information about modulator
228 programming see :ref:`tuner`.
229 * - ``V4L2_CAP_SDR_CAPTURE``
231 - The device supports the :ref:`SDR Capture <sdr>` interface.
232 * - ``V4L2_CAP_EXT_PIX_FORMAT``
234 - The device supports the struct
235 :c:type:`v4l2_pix_format` extended fields.
236 * - ``V4L2_CAP_SDR_OUTPUT``
238 - The device supports the :ref:`SDR Output <sdr>` interface.
239 * - ``V4L2_CAP_READWRITE``
241 - The device supports the :ref:`read() <rw>` and/or
242 :ref:`write() <rw>` I/O methods.
243 * - ``V4L2_CAP_ASYNCIO``
245 - The device supports the :ref:`asynchronous <async>` I/O methods.
246 * - ``V4L2_CAP_STREAMING``
248 - The device supports the :ref:`streaming <mmap>` I/O method.
249 * - ``V4L2_CAP_TOUCH``
251 - This is a touch device.
252 * - ``V4L2_CAP_DEVICE_CAPS``
254 - The driver fills the ``device_caps`` field. This capability can
255 only appear in the ``capabilities`` field and never in the
256 ``device_caps`` field.
262 On success 0 is returned, on error -1 and the ``errno`` variable is set
263 appropriately. The generic error codes are described at the
264 :ref:`Generic Error Codes <gen-errors>` chapter.
267 The struct :c:type:`v4l2_framebuffer` lacks an
268 enum :c:type:`v4l2_buf_type` field, therefore the
269 type of overlay is implied by the driver capabilities.