8.48. ioctl VIDIOC_QUERYCAP¶
VIDIOC_QUERYCAP - Query device capabilities
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
v4l2_capability which is
filled by the driver. When the driver is not compatible with this
specification the ioctl returns an
EINVAL error code.
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.
|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
string to avoid ambiguities.
|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:vivi-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.
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
|Available capabilities of the physical device as a whole, see
Device Capabilities Flags. The same physical device can export
multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and
capabilities field should contain a union of
all capabilities available around the several V4L2 devices
exported to userspace. For all those devices the
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
|Device capabilities of the opened device, see
Device Capabilities Flags. 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
field can have the
device_caps will never set
|Reserved for future extensions. Drivers must set this array to zero.
|The device supports the single-planar API through the Video Capture interface.
|The device supports the multi-planar API through the Video Capture interface.
|The device supports the single-planar API through the Video Output interface.
|The device supports the multi-planar API through the Video Output interface.
|The device supports the single-planar API through the Video Memory-To-Memory interface.
|The device supports the multi-planar API through the Video Memory-To-Memory interface.
|The device supports the Video Overlay interface. A video overlay device typically stores captured images directly in the video memory of a graphics card, with hardware clipping and scaling.
|The device supports the Raw VBI Capture interface, providing Teletext and Closed Caption data.
|The device supports the Raw VBI Output interface.
|The device supports the Sliced VBI Capture interface.
|The device supports the Sliced VBI Output interface.
|The device supports the RDS capture interface.
|The device supports the Video Output Overlay (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
|The device supports the ioctl VIDIOC_S_HW_FREQ_SEEK ioctl for hardware frequency seeking.
|The device supports the RDS output interface.
|The device has some sort of tuner to receive RF-modulated video signals. For more information about tuner programming see Tuners and Modulators.
|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 Audio Inputs and Outputs.
|This is a radio receiver.
|The device has some sort of modulator to emit RF-modulated video/audio signals. For more information about modulator programming see Tuners and Modulators.
|The device supports the SDR Capture interface.
|The device supports the struct
v4l2_pix_format extended fields.
|The device supports the SDR Output interface.
|The device supports the read() and/or write() I/O methods.
|The device supports the asynchronous I/O methods.
|The device supports the streaming I/O method.
|This is a touch device.
|The driver fills the
device_caps field. This capability can
only appear in the
capabilities field and never in the
8.48.5. 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
Generic Error Codes chapter.
v4l2_framebuffer lacks an
v4l2_buf_type field, therefore the
type of overlay is implied by the driver capabilities.