0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 .. c:namespace:: V4L
0003
0004 .. _VIDIOC_SUBDEV_QUERYCAP:
0005
0006 ****************************
0007 ioctl VIDIOC_SUBDEV_QUERYCAP
0008 ****************************
0009
0010 Name
0011 ====
0012
0013 VIDIOC_SUBDEV_QUERYCAP - Query sub-device capabilities
0014
0015 Synopsis
0016 ========
0017
0018 .. c:macro:: VIDIOC_SUBDEV_QUERYCAP
0019
0020 ``int ioctl(int fd, VIDIOC_SUBDEV_QUERYCAP, struct v4l2_subdev_capability *argp)``
0021
0022 Arguments
0023 =========
0024
0025 ``fd``
0026 File descriptor returned by :c:func:`open()`.
0027
0028 ``argp``
0029 Pointer to struct :c:type:`v4l2_subdev_capability`.
0030
0031 Description
0032 ===========
0033
0034 All V4L2 sub-devices support the ``VIDIOC_SUBDEV_QUERYCAP`` ioctl. It is used to
0035 identify kernel devices compatible with this specification and to obtain
0036 information about driver and hardware capabilities. The ioctl takes a pointer to
0037 a struct :c:type:`v4l2_subdev_capability` which is filled by the driver. When
0038 the driver is not compatible with this specification the ioctl returns
0039 ``ENOTTY`` error code.
0040
0041 .. tabularcolumns:: |p{1.5cm}|p{2.9cm}|p{12.9cm}|
0042
0043 .. c:type:: v4l2_subdev_capability
0044
0045 .. flat-table:: struct v4l2_subdev_capability
0046 :header-rows: 0
0047 :stub-columns: 0
0048 :widths: 3 4 20
0049
0050 * - __u32
0051 - ``version``
0052 - Version number of the driver.
0053
0054 The version reported is provided by the V4L2 subsystem following the
0055 kernel numbering scheme. However, it may not always return the same
0056 version as the kernel if, for example, a stable or
0057 distribution-modified kernel uses the V4L2 stack from a newer kernel.
0058
0059 The version number is formatted using the ``KERNEL_VERSION()``
0060 macro:
0061 * - :cspan:`2`
0062
0063 ``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
0064
0065 ``__u32 version = KERNEL_VERSION(0, 8, 1);``
0066
0067 ``printf ("Version: %u.%u.%u\\n",``
0068
0069 ``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
0070 * - __u32
0071 - ``capabilities``
0072 - Sub-device capabilities of the opened device, see
0073 :ref:`subdevice-capabilities`.
0074 * - __u32
0075 - ``reserved``\ [14]
0076 - Reserved for future extensions. Set to 0 by the V4L2 core.
0077
0078 .. tabularcolumns:: |p{6.8cm}|p{2.4cm}|p{8.1cm}|
0079
0080 .. _subdevice-capabilities:
0081
0082 .. cssclass:: longtable
0083
0084 .. flat-table:: Sub-Device Capabilities Flags
0085 :header-rows: 0
0086 :stub-columns: 0
0087 :widths: 3 1 4
0088
0089 * - V4L2_SUBDEV_CAP_RO_SUBDEV
0090 - 0x00000001
0091 - The sub-device device node is registered in read-only mode.
0092 Access to the sub-device ioctls that modify the device state is
0093 restricted. Refer to each individual subdevice ioctl documentation
0094 for a description of which restrictions apply to a read-only sub-device.
0095
0096 Return Value
0097 ============
0098
0099 On success 0 is returned, on error -1 and the ``errno`` variable is set
0100 appropriately. The generic error codes are described at the
0101 :ref:`Generic Error Codes <gen-errors>` chapter.
0102
0103 ENOTTY
0104 The device node is not a V4L2 sub-device.