brintos

brintos / linux-shallow public Read only

0
0
Text · 10.7 KiB · 3d11d86 Raw
290 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2.. c:namespace:: V4L3 4.. _VIDIOC_QUERYCAP:5 6*********************7ioctl VIDIOC_QUERYCAP8*********************9 10Name11====12 13VIDIOC_QUERYCAP - Query device capabilities14 15Synopsis16========17 18.. c:macro:: VIDIOC_QUERYCAP19 20``int ioctl(int fd, VIDIOC_QUERYCAP, struct v4l2_capability *argp)``21 22Arguments23=========24 25``fd``26    File descriptor returned by :c:func:`open()`.27 28``argp``29    Pointer to struct :c:type:`v4l2_capability`.30 31Description32===========33 34All V4L2 devices support the ``VIDIOC_QUERYCAP`` ioctl. It is used to35identify kernel devices compatible with this specification and to obtain36information about driver and hardware capabilities. The ioctl takes a37pointer to a struct :c:type:`v4l2_capability` which is38filled by the driver. When the driver is not compatible with this39specification the ioctl returns an ``EINVAL`` error code.40 41.. c:type:: v4l2_capability42 43.. tabularcolumns:: |p{1.4cm}|p{2.8cm}|p{13.1cm}|44 45.. cssclass:: longtable46 47.. flat-table:: struct v4l2_capability48    :header-rows:  049    :stub-columns: 050    :widths:       3 4 2051 52    * - __u853      - ``driver``\ [16]54      - Name of the driver, a unique NUL-terminated ASCII string. For55	example: "bttv". Driver specific applications can use this56	information to verify the driver identity. It is also useful to57	work around known bugs, or to identify drivers in error reports.58 59	Storing strings in fixed sized arrays is bad practice but60	unavoidable here. Drivers and applications should take precautions61	to never read or write beyond the end of the array and to make62	sure the strings are properly NUL-terminated.63    * - __u864      - ``card``\ [32]65      - Name of the device, a NUL-terminated UTF-8 string. For example:66	"Yoyodyne TV/FM". One driver may support different brands or67	models of video hardware. This information is intended for users,68	for example in a menu of available devices. Since multiple TV69	cards of the same brand may be installed which are supported by70	the same driver, this name should be combined with the character71	device file name (e. g. ``/dev/video2``) or the ``bus_info``72	string to avoid ambiguities.73    * - __u874      - ``bus_info``\ [32]75      - Location of the device in the system, a NUL-terminated ASCII76	string. For example: "PCI:0000:05:06.0". This information is77	intended for users, to distinguish multiple identical devices. If78	no such information is available the field must simply count the79	devices controlled by the driver ("platform:vivid-000"). The80	bus_info must start with "PCI:" for PCI boards, "PCIe:" for PCI81	Express boards, "usb-" for USB devices, "I2C:" for i2c devices,82	"ISA:" for ISA devices, "parport" for parallel port devices and83	"platform:" for platform devices.84    * - __u3285      - ``version``86      - Version number of the driver.87 88	Starting with kernel 3.1, the version reported is provided by the89	V4L2 subsystem following the kernel numbering scheme. However, it90	may not always return the same version as the kernel if, for91	example, a stable or distribution-modified kernel uses the V4L292	stack from a newer kernel.93 94	The version number is formatted using the ``KERNEL_VERSION()``95	macro. For example if the media stack corresponds to the V4L296	version shipped with Kernel 4.14, it would be equivalent to:97    * - :cspan:`2`98 99	``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``100 101	``__u32 version = KERNEL_VERSION(4, 14, 0);``102 103	``printf ("Version: %u.%u.%u\\n",``104 105	``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``106    * - __u32107      - ``capabilities``108      - Available capabilities of the physical device as a whole, see109	:ref:`device-capabilities`. The same physical device can export110	multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and111	/dev/radioZ). The ``capabilities`` field should contain a union of112	all capabilities available around the several V4L2 devices113	exported to userspace. For all those devices the ``capabilities``114	field returns the same set of capabilities. This allows115	applications to open just one of the devices (typically the video116	device) and discover whether video, vbi and/or radio are also117	supported.118    * - __u32119      - ``device_caps``120      - Device capabilities of the opened device, see121	:ref:`device-capabilities`. Should contain the available122	capabilities of that specific device node. So, for example,123	``device_caps`` of a radio device will only contain radio related124	capabilities and no video or vbi capabilities. This field is only125	set if the ``capabilities`` field contains the126	``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``.129    * - __u32130      - ``reserved``\ [3]131      - Reserved for future extensions. Drivers must set this array to132	zero.133 134 135.. tabularcolumns:: |p{7.0cm}|p{2.6cm}|p{7.7cm}|136 137.. _device-capabilities:138 139.. cssclass:: longtable140 141.. flat-table:: Device Capabilities Flags142    :header-rows:  0143    :stub-columns: 0144    :widths:       3 1 4145 146    * - ``V4L2_CAP_VIDEO_CAPTURE``147      - 0x00000001148      - The device supports the single-planar API through the149	:ref:`Video Capture <capture>` interface.150    * - ``V4L2_CAP_VIDEO_CAPTURE_MPLANE``151      - 0x00001000152      - The device supports the :ref:`multi-planar API <planar-apis>`153	through the :ref:`Video Capture <capture>` interface.154    * - ``V4L2_CAP_VIDEO_OUTPUT``155      - 0x00000002156      - The device supports the single-planar API through the157	:ref:`Video Output <output>` interface.158    * - ``V4L2_CAP_VIDEO_OUTPUT_MPLANE``159      - 0x00002000160      - The device supports the :ref:`multi-planar API <planar-apis>`161	through the :ref:`Video Output <output>` interface.162    * - ``V4L2_CAP_VIDEO_M2M``163      - 0x00008000164      - The device supports the single-planar API through the Video165	Memory-To-Memory interface.166    * - ``V4L2_CAP_VIDEO_M2M_MPLANE``167      - 0x00004000168      - The device supports the :ref:`multi-planar API <planar-apis>`169	through the Video Memory-To-Memory interface.170    * - ``V4L2_CAP_VIDEO_OVERLAY``171      - 0x00000004172      - The device supports the :ref:`Video Overlay <overlay>`173	interface. A video overlay device typically stores captured images174	directly in the video memory of a graphics card, with hardware175	clipping and scaling.176    * - ``V4L2_CAP_VBI_CAPTURE``177      - 0x00000010178      - The device supports the :ref:`Raw VBI Capture <raw-vbi>`179	interface, providing Teletext and Closed Caption data.180    * - ``V4L2_CAP_VBI_OUTPUT``181      - 0x00000020182      - The device supports the :ref:`Raw VBI Output <raw-vbi>`183	interface.184    * - ``V4L2_CAP_SLICED_VBI_CAPTURE``185      - 0x00000040186      - The device supports the :ref:`Sliced VBI Capture <sliced>`187	interface.188    * - ``V4L2_CAP_SLICED_VBI_OUTPUT``189      - 0x00000080190      - The device supports the :ref:`Sliced VBI Output <sliced>`191	interface.192    * - ``V4L2_CAP_RDS_CAPTURE``193      - 0x00000100194      - The device supports the :ref:`RDS <rds>` capture interface.195    * - ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY``196      - 0x00000200197      - The device supports the :ref:`Video Output Overlay <osd>` (OSD)198	interface. Unlike the *Video Overlay* interface, this is a199	secondary function of video output devices and overlays an image200	onto an outgoing video signal. When the driver sets this flag, it201	must clear the ``V4L2_CAP_VIDEO_OVERLAY`` flag and vice202	versa. [#f1]_203    * - ``V4L2_CAP_HW_FREQ_SEEK``204      - 0x00000400205      - The device supports the206	:ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl207	for hardware frequency seeking.208    * - ``V4L2_CAP_RDS_OUTPUT``209      - 0x00000800210      - The device supports the :ref:`RDS <rds>` output interface.211    * - ``V4L2_CAP_TUNER``212      - 0x00010000213      - The device has some sort of tuner to receive RF-modulated video214	signals. For more information about tuner programming see215	:ref:`tuner`.216    * - ``V4L2_CAP_AUDIO``217      - 0x00020000218      - The device has audio inputs or outputs. It may or may not support219	audio recording or playback, in PCM or compressed formats. PCM220	audio support must be implemented as ALSA or OSS interface. For221	more information on audio inputs and outputs see :ref:`audio`.222    * - ``V4L2_CAP_RADIO``223      - 0x00040000224      - This is a radio receiver.225    * - ``V4L2_CAP_MODULATOR``226      - 0x00080000227      - The device has some sort of modulator to emit RF-modulated228	video/audio signals. For more information about modulator229	programming see :ref:`tuner`.230    * - ``V4L2_CAP_SDR_CAPTURE``231      - 0x00100000232      - The device supports the :ref:`SDR Capture <sdr>` interface.233    * - ``V4L2_CAP_EXT_PIX_FORMAT``234      - 0x00200000235      - The device supports the struct236	:c:type:`v4l2_pix_format` extended fields.237    * - ``V4L2_CAP_SDR_OUTPUT``238      - 0x00400000239      - The device supports the :ref:`SDR Output <sdr>` interface.240    * - ``V4L2_CAP_META_CAPTURE``241      - 0x00800000242      - The device supports the :ref:`metadata` capture interface.243    * - ``V4L2_CAP_READWRITE``244      - 0x01000000245      - The device supports the :c:func:`read()` and/or246	:c:func:`write()` I/O methods.247    * - ``V4L2_CAP_EDID``248      - 0x02000000249      - The device stores the EDID for a video input, or retrieves the EDID for a video250        output. It is a standalone EDID device, so no video streaming etc. will take place.251 252        For a video input this is typically an eeprom that supports the253        :ref:`VESA Enhanced Display Data Channel Standard <vesaeddc>`. It can be something254        else as well, for example a micro controller.255 256        For a video output this is typically read from an external device such as an257        HDMI splitter accessed by a serial port.258    * - ``V4L2_CAP_STREAMING``259      - 0x04000000260      - The device supports the :ref:`streaming <mmap>` I/O method.261    * - ``V4L2_CAP_META_OUTPUT``262      - 0x08000000263      - The device supports the :ref:`metadata` output interface.264    * - ``V4L2_CAP_TOUCH``265      - 0x10000000266      - This is a touch device.267    * - ``V4L2_CAP_IO_MC``268      - 0x20000000269      - There is only one input and/or output seen from userspace. The whole270        video topology configuration, including which I/O entity is routed to271        the input/output, is configured by userspace via the Media Controller.272        See :ref:`media_controller`.273    * - ``V4L2_CAP_DEVICE_CAPS``274      - 0x80000000275      - The driver fills the ``device_caps`` field. This capability can276	only appear in the ``capabilities`` field and never in the277	``device_caps`` field.278 279Return Value280============281 282On success 0 is returned, on error -1 and the ``errno`` variable is set283appropriately. The generic error codes are described at the284:ref:`Generic Error Codes <gen-errors>` chapter.285 286.. [#f1]287   The struct :c:type:`v4l2_framebuffer` lacks an288   enum :c:type:`v4l2_buf_type` field, therefore the289   type of overlay is implied by the driver capabilities.290