18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: V4L 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _VIDIOC_QUERYCAP: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci********************* 78c2ecf20Sopenharmony_ciioctl VIDIOC_QUERYCAP 88c2ecf20Sopenharmony_ci********************* 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciVIDIOC_QUERYCAP - Query device capabilities 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci======== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_QUERYCAP 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_QUERYCAP, struct v4l2_capability *argp)`` 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciArguments 238c2ecf20Sopenharmony_ci========= 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci``fd`` 268c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci``argp`` 298c2ecf20Sopenharmony_ci Pointer to struct :c:type:`v4l2_capability`. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciDescription 328c2ecf20Sopenharmony_ci=========== 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciAll V4L2 devices support the ``VIDIOC_QUERYCAP`` ioctl. It is used to 358c2ecf20Sopenharmony_ciidentify kernel devices compatible with this specification and to obtain 368c2ecf20Sopenharmony_ciinformation about driver and hardware capabilities. The ioctl takes a 378c2ecf20Sopenharmony_cipointer to a struct :c:type:`v4l2_capability` which is 388c2ecf20Sopenharmony_cifilled by the driver. When the driver is not compatible with this 398c2ecf20Sopenharmony_cispecification the ioctl returns an ``EINVAL`` error code. 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{1.5cm}|p{2.5cm}|p{13cm}| 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci.. c:type:: v4l2_capability 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_capability 468c2ecf20Sopenharmony_ci :header-rows: 0 478c2ecf20Sopenharmony_ci :stub-columns: 0 488c2ecf20Sopenharmony_ci :widths: 3 4 20 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci * - __u8 518c2ecf20Sopenharmony_ci - ``driver``\ [16] 528c2ecf20Sopenharmony_ci - Name of the driver, a unique NUL-terminated ASCII string. For 538c2ecf20Sopenharmony_ci example: "bttv". Driver specific applications can use this 548c2ecf20Sopenharmony_ci information to verify the driver identity. It is also useful to 558c2ecf20Sopenharmony_ci work around known bugs, or to identify drivers in error reports. 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci Storing strings in fixed sized arrays is bad practice but 588c2ecf20Sopenharmony_ci unavoidable here. Drivers and applications should take precautions 598c2ecf20Sopenharmony_ci to never read or write beyond the end of the array and to make 608c2ecf20Sopenharmony_ci sure the strings are properly NUL-terminated. 618c2ecf20Sopenharmony_ci * - __u8 628c2ecf20Sopenharmony_ci - ``card``\ [32] 638c2ecf20Sopenharmony_ci - Name of the device, a NUL-terminated UTF-8 string. For example: 648c2ecf20Sopenharmony_ci "Yoyodyne TV/FM". One driver may support different brands or 658c2ecf20Sopenharmony_ci models of video hardware. This information is intended for users, 668c2ecf20Sopenharmony_ci for example in a menu of available devices. Since multiple TV 678c2ecf20Sopenharmony_ci cards of the same brand may be installed which are supported by 688c2ecf20Sopenharmony_ci the same driver, this name should be combined with the character 698c2ecf20Sopenharmony_ci device file name (e. g. ``/dev/video2``) or the ``bus_info`` 708c2ecf20Sopenharmony_ci string to avoid ambiguities. 718c2ecf20Sopenharmony_ci * - __u8 728c2ecf20Sopenharmony_ci - ``bus_info``\ [32] 738c2ecf20Sopenharmony_ci - Location of the device in the system, a NUL-terminated ASCII 748c2ecf20Sopenharmony_ci string. For example: "PCI:0000:05:06.0". This information is 758c2ecf20Sopenharmony_ci intended for users, to distinguish multiple identical devices. If 768c2ecf20Sopenharmony_ci no such information is available the field must simply count the 778c2ecf20Sopenharmony_ci devices controlled by the driver ("platform:vivid-000"). The 788c2ecf20Sopenharmony_ci bus_info must start with "PCI:" for PCI boards, "PCIe:" for PCI 798c2ecf20Sopenharmony_ci Express boards, "usb-" for USB devices, "I2C:" for i2c devices, 808c2ecf20Sopenharmony_ci "ISA:" for ISA devices, "parport" for parallel port devices and 818c2ecf20Sopenharmony_ci "platform:" for platform devices. 828c2ecf20Sopenharmony_ci * - __u32 838c2ecf20Sopenharmony_ci - ``version`` 848c2ecf20Sopenharmony_ci - Version number of the driver. 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci Starting with kernel 3.1, the version reported is provided by the 878c2ecf20Sopenharmony_ci V4L2 subsystem following the kernel numbering scheme. However, it 888c2ecf20Sopenharmony_ci may not always return the same version as the kernel if, for 898c2ecf20Sopenharmony_ci example, a stable or distribution-modified kernel uses the V4L2 908c2ecf20Sopenharmony_ci stack from a newer kernel. 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci The version number is formatted using the ``KERNEL_VERSION()`` 938c2ecf20Sopenharmony_ci macro. For example if the media stack corresponds to the V4L2 948c2ecf20Sopenharmony_ci version shipped with Kernel 4.14, it would be equivalent to: 958c2ecf20Sopenharmony_ci * - :cspan:`2` 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci ``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))`` 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci ``__u32 version = KERNEL_VERSION(4, 14, 0);`` 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci ``printf ("Version: %u.%u.%u\\n",`` 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci ``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);`` 1048c2ecf20Sopenharmony_ci * - __u32 1058c2ecf20Sopenharmony_ci - ``capabilities`` 1068c2ecf20Sopenharmony_ci - Available capabilities of the physical device as a whole, see 1078c2ecf20Sopenharmony_ci :ref:`device-capabilities`. The same physical device can export 1088c2ecf20Sopenharmony_ci multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and 1098c2ecf20Sopenharmony_ci /dev/radioZ). The ``capabilities`` field should contain a union of 1108c2ecf20Sopenharmony_ci all capabilities available around the several V4L2 devices 1118c2ecf20Sopenharmony_ci exported to userspace. For all those devices the ``capabilities`` 1128c2ecf20Sopenharmony_ci field returns the same set of capabilities. This allows 1138c2ecf20Sopenharmony_ci applications to open just one of the devices (typically the video 1148c2ecf20Sopenharmony_ci device) and discover whether video, vbi and/or radio are also 1158c2ecf20Sopenharmony_ci supported. 1168c2ecf20Sopenharmony_ci * - __u32 1178c2ecf20Sopenharmony_ci - ``device_caps`` 1188c2ecf20Sopenharmony_ci - Device capabilities of the opened device, see 1198c2ecf20Sopenharmony_ci :ref:`device-capabilities`. Should contain the available 1208c2ecf20Sopenharmony_ci capabilities of that specific device node. So, for example, 1218c2ecf20Sopenharmony_ci ``device_caps`` of a radio device will only contain radio related 1228c2ecf20Sopenharmony_ci capabilities and no video or vbi capabilities. This field is only 1238c2ecf20Sopenharmony_ci set if the ``capabilities`` field contains the 1248c2ecf20Sopenharmony_ci ``V4L2_CAP_DEVICE_CAPS`` capability. Only the ``capabilities`` 1258c2ecf20Sopenharmony_ci field can have the ``V4L2_CAP_DEVICE_CAPS`` capability, 1268c2ecf20Sopenharmony_ci ``device_caps`` will never set ``V4L2_CAP_DEVICE_CAPS``. 1278c2ecf20Sopenharmony_ci * - __u32 1288c2ecf20Sopenharmony_ci - ``reserved``\ [3] 1298c2ecf20Sopenharmony_ci - Reserved for future extensions. Drivers must set this array to 1308c2ecf20Sopenharmony_ci zero. 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.1cm}|p{2.2cm}|p{8.7cm}| 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci.. _device-capabilities: 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci.. cssclass:: longtable 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci.. flat-table:: Device Capabilities Flags 1408c2ecf20Sopenharmony_ci :header-rows: 0 1418c2ecf20Sopenharmony_ci :stub-columns: 0 1428c2ecf20Sopenharmony_ci :widths: 3 1 4 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VIDEO_CAPTURE`` 1458c2ecf20Sopenharmony_ci - 0x00000001 1468c2ecf20Sopenharmony_ci - The device supports the single-planar API through the 1478c2ecf20Sopenharmony_ci :ref:`Video Capture <capture>` interface. 1488c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VIDEO_CAPTURE_MPLANE`` 1498c2ecf20Sopenharmony_ci - 0x00001000 1508c2ecf20Sopenharmony_ci - The device supports the :ref:`multi-planar API <planar-apis>` 1518c2ecf20Sopenharmony_ci through the :ref:`Video Capture <capture>` interface. 1528c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VIDEO_OUTPUT`` 1538c2ecf20Sopenharmony_ci - 0x00000002 1548c2ecf20Sopenharmony_ci - The device supports the single-planar API through the 1558c2ecf20Sopenharmony_ci :ref:`Video Output <output>` interface. 1568c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VIDEO_OUTPUT_MPLANE`` 1578c2ecf20Sopenharmony_ci - 0x00002000 1588c2ecf20Sopenharmony_ci - The device supports the :ref:`multi-planar API <planar-apis>` 1598c2ecf20Sopenharmony_ci through the :ref:`Video Output <output>` interface. 1608c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VIDEO_M2M`` 1618c2ecf20Sopenharmony_ci - 0x00008000 1628c2ecf20Sopenharmony_ci - The device supports the single-planar API through the Video 1638c2ecf20Sopenharmony_ci Memory-To-Memory interface. 1648c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VIDEO_M2M_MPLANE`` 1658c2ecf20Sopenharmony_ci - 0x00004000 1668c2ecf20Sopenharmony_ci - The device supports the :ref:`multi-planar API <planar-apis>` 1678c2ecf20Sopenharmony_ci through the Video Memory-To-Memory interface. 1688c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VIDEO_OVERLAY`` 1698c2ecf20Sopenharmony_ci - 0x00000004 1708c2ecf20Sopenharmony_ci - The device supports the :ref:`Video Overlay <overlay>` 1718c2ecf20Sopenharmony_ci interface. A video overlay device typically stores captured images 1728c2ecf20Sopenharmony_ci directly in the video memory of a graphics card, with hardware 1738c2ecf20Sopenharmony_ci clipping and scaling. 1748c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VBI_CAPTURE`` 1758c2ecf20Sopenharmony_ci - 0x00000010 1768c2ecf20Sopenharmony_ci - The device supports the :ref:`Raw VBI Capture <raw-vbi>` 1778c2ecf20Sopenharmony_ci interface, providing Teletext and Closed Caption data. 1788c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VBI_OUTPUT`` 1798c2ecf20Sopenharmony_ci - 0x00000020 1808c2ecf20Sopenharmony_ci - The device supports the :ref:`Raw VBI Output <raw-vbi>` 1818c2ecf20Sopenharmony_ci interface. 1828c2ecf20Sopenharmony_ci * - ``V4L2_CAP_SLICED_VBI_CAPTURE`` 1838c2ecf20Sopenharmony_ci - 0x00000040 1848c2ecf20Sopenharmony_ci - The device supports the :ref:`Sliced VBI Capture <sliced>` 1858c2ecf20Sopenharmony_ci interface. 1868c2ecf20Sopenharmony_ci * - ``V4L2_CAP_SLICED_VBI_OUTPUT`` 1878c2ecf20Sopenharmony_ci - 0x00000080 1888c2ecf20Sopenharmony_ci - The device supports the :ref:`Sliced VBI Output <sliced>` 1898c2ecf20Sopenharmony_ci interface. 1908c2ecf20Sopenharmony_ci * - ``V4L2_CAP_RDS_CAPTURE`` 1918c2ecf20Sopenharmony_ci - 0x00000100 1928c2ecf20Sopenharmony_ci - The device supports the :ref:`RDS <rds>` capture interface. 1938c2ecf20Sopenharmony_ci * - ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY`` 1948c2ecf20Sopenharmony_ci - 0x00000200 1958c2ecf20Sopenharmony_ci - The device supports the :ref:`Video Output Overlay <osd>` (OSD) 1968c2ecf20Sopenharmony_ci interface. Unlike the *Video Overlay* interface, this is a 1978c2ecf20Sopenharmony_ci secondary function of video output devices and overlays an image 1988c2ecf20Sopenharmony_ci onto an outgoing video signal. When the driver sets this flag, it 1998c2ecf20Sopenharmony_ci must clear the ``V4L2_CAP_VIDEO_OVERLAY`` flag and vice 2008c2ecf20Sopenharmony_ci versa. [#f1]_ 2018c2ecf20Sopenharmony_ci * - ``V4L2_CAP_HW_FREQ_SEEK`` 2028c2ecf20Sopenharmony_ci - 0x00000400 2038c2ecf20Sopenharmony_ci - The device supports the 2048c2ecf20Sopenharmony_ci :ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl 2058c2ecf20Sopenharmony_ci for hardware frequency seeking. 2068c2ecf20Sopenharmony_ci * - ``V4L2_CAP_RDS_OUTPUT`` 2078c2ecf20Sopenharmony_ci - 0x00000800 2088c2ecf20Sopenharmony_ci - The device supports the :ref:`RDS <rds>` output interface. 2098c2ecf20Sopenharmony_ci * - ``V4L2_CAP_TUNER`` 2108c2ecf20Sopenharmony_ci - 0x00010000 2118c2ecf20Sopenharmony_ci - The device has some sort of tuner to receive RF-modulated video 2128c2ecf20Sopenharmony_ci signals. For more information about tuner programming see 2138c2ecf20Sopenharmony_ci :ref:`tuner`. 2148c2ecf20Sopenharmony_ci * - ``V4L2_CAP_AUDIO`` 2158c2ecf20Sopenharmony_ci - 0x00020000 2168c2ecf20Sopenharmony_ci - The device has audio inputs or outputs. It may or may not support 2178c2ecf20Sopenharmony_ci audio recording or playback, in PCM or compressed formats. PCM 2188c2ecf20Sopenharmony_ci audio support must be implemented as ALSA or OSS interface. For 2198c2ecf20Sopenharmony_ci more information on audio inputs and outputs see :ref:`audio`. 2208c2ecf20Sopenharmony_ci * - ``V4L2_CAP_RADIO`` 2218c2ecf20Sopenharmony_ci - 0x00040000 2228c2ecf20Sopenharmony_ci - This is a radio receiver. 2238c2ecf20Sopenharmony_ci * - ``V4L2_CAP_MODULATOR`` 2248c2ecf20Sopenharmony_ci - 0x00080000 2258c2ecf20Sopenharmony_ci - The device has some sort of modulator to emit RF-modulated 2268c2ecf20Sopenharmony_ci video/audio signals. For more information about modulator 2278c2ecf20Sopenharmony_ci programming see :ref:`tuner`. 2288c2ecf20Sopenharmony_ci * - ``V4L2_CAP_SDR_CAPTURE`` 2298c2ecf20Sopenharmony_ci - 0x00100000 2308c2ecf20Sopenharmony_ci - The device supports the :ref:`SDR Capture <sdr>` interface. 2318c2ecf20Sopenharmony_ci * - ``V4L2_CAP_EXT_PIX_FORMAT`` 2328c2ecf20Sopenharmony_ci - 0x00200000 2338c2ecf20Sopenharmony_ci - The device supports the struct 2348c2ecf20Sopenharmony_ci :c:type:`v4l2_pix_format` extended fields. 2358c2ecf20Sopenharmony_ci * - ``V4L2_CAP_SDR_OUTPUT`` 2368c2ecf20Sopenharmony_ci - 0x00400000 2378c2ecf20Sopenharmony_ci - The device supports the :ref:`SDR Output <sdr>` interface. 2388c2ecf20Sopenharmony_ci * - ``V4L2_CAP_META_CAPTURE`` 2398c2ecf20Sopenharmony_ci - 0x00800000 2408c2ecf20Sopenharmony_ci - The device supports the :ref:`metadata` capture interface. 2418c2ecf20Sopenharmony_ci * - ``V4L2_CAP_READWRITE`` 2428c2ecf20Sopenharmony_ci - 0x01000000 2438c2ecf20Sopenharmony_ci - The device supports the :c:func:`read()` and/or 2448c2ecf20Sopenharmony_ci :c:func:`write()` I/O methods. 2458c2ecf20Sopenharmony_ci * - ``V4L2_CAP_ASYNCIO`` 2468c2ecf20Sopenharmony_ci - 0x02000000 2478c2ecf20Sopenharmony_ci - The device supports the :ref:`asynchronous <async>` I/O methods. 2488c2ecf20Sopenharmony_ci * - ``V4L2_CAP_STREAMING`` 2498c2ecf20Sopenharmony_ci - 0x04000000 2508c2ecf20Sopenharmony_ci - The device supports the :ref:`streaming <mmap>` I/O method. 2518c2ecf20Sopenharmony_ci * - ``V4L2_CAP_META_OUTPUT`` 2528c2ecf20Sopenharmony_ci - 0x08000000 2538c2ecf20Sopenharmony_ci - The device supports the :ref:`metadata` output interface. 2548c2ecf20Sopenharmony_ci * - ``V4L2_CAP_TOUCH`` 2558c2ecf20Sopenharmony_ci - 0x10000000 2568c2ecf20Sopenharmony_ci - This is a touch device. 2578c2ecf20Sopenharmony_ci * - ``V4L2_CAP_IO_MC`` 2588c2ecf20Sopenharmony_ci - 0x20000000 2598c2ecf20Sopenharmony_ci - There is only one input and/or output seen from userspace. The whole 2608c2ecf20Sopenharmony_ci video topology configuration, including which I/O entity is routed to 2618c2ecf20Sopenharmony_ci the input/output, is configured by userspace via the Media Controller. 2628c2ecf20Sopenharmony_ci See :ref:`media_controller`. 2638c2ecf20Sopenharmony_ci * - ``V4L2_CAP_DEVICE_CAPS`` 2648c2ecf20Sopenharmony_ci - 0x80000000 2658c2ecf20Sopenharmony_ci - The driver fills the ``device_caps`` field. This capability can 2668c2ecf20Sopenharmony_ci only appear in the ``capabilities`` field and never in the 2678c2ecf20Sopenharmony_ci ``device_caps`` field. 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ciReturn Value 2708c2ecf20Sopenharmony_ci============ 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 2738c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 2748c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci.. [#f1] 2778c2ecf20Sopenharmony_ci The struct :c:type:`v4l2_framebuffer` lacks an 2788c2ecf20Sopenharmony_ci enum :c:type:`v4l2_buf_type` field, therefore the 2798c2ecf20Sopenharmony_ci type of overlay is implied by the driver capabilities. 280