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