1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3.. _VIDIOC_SUBDEV_QUERYCAP:
4
5****************************
6ioctl VIDIOC_SUBDEV_QUERYCAP
7****************************
8
9Name
10====
11
12VIDIOC_SUBDEV_QUERYCAP - Query sub-device capabilities
13
14
15Synopsis
16========
17
18.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_QUERYCAP, struct v4l2_subdev_capability *argp )
19    :name: VIDIOC_SUBDEV_QUERYCAP
20
21
22Arguments
23=========
24
25``fd``
26    File descriptor returned by :ref:`open() <func-open>`.
27
28``argp``
29    Pointer to struct :c:type:`v4l2_subdev_capability`.
30
31
32Description
33===========
34
35All V4L2 sub-devices support the ``VIDIOC_SUBDEV_QUERYCAP`` ioctl. It is used to
36identify kernel devices compatible with this specification and to obtain
37information about driver and hardware capabilities. The ioctl takes a pointer to
38a struct :c:type:`v4l2_subdev_capability` which is filled by the driver. When
39the driver is not compatible with this specification the ioctl returns
40``ENOTTY`` error code.
41
42.. tabularcolumns:: |p{1.5cm}|p{2.5cm}|p{13cm}|
43
44.. c:type:: v4l2_subdev_capability
45
46.. flat-table:: struct v4l2_subdev_capability
47    :header-rows:  0
48    :stub-columns: 0
49    :widths:       3 4 20
50
51    * - __u32
52      - ``version``
53      - Version number of the driver.
54
55	The version reported is provided by the V4L2 subsystem following the
56	kernel numbering scheme. However, it may not always return the same
57	version as the kernel if, for example, a stable or
58	distribution-modified kernel uses the V4L2 stack from a newer kernel.
59
60	The version number is formatted using the ``KERNEL_VERSION()``
61	macro:
62    * - :cspan:`2`
63
64	``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
65
66	``__u32 version = KERNEL_VERSION(0, 8, 1);``
67
68	``printf ("Version: %u.%u.%u\\n",``
69
70	``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
71    * - __u32
72      - ``capabilities``
73      - Sub-device capabilities of the opened device, see
74	:ref:`subdevice-capabilities`.
75    * - __u32
76      - ``reserved``\ [14]
77      - Reserved for future extensions. Set to 0 by the V4L2 core.
78
79.. tabularcolumns:: |p{6cm}|p{2.2cm}|p{8.8cm}|
80
81.. _subdevice-capabilities:
82
83.. cssclass:: longtable
84
85.. flat-table:: Sub-Device Capabilities Flags
86    :header-rows:  0
87    :stub-columns: 0
88    :widths:       3 1 4
89
90    * - V4L2_SUBDEV_CAP_RO_SUBDEV
91      - 0x00000001
92      - The sub-device device node is registered in read-only mode.
93	Access to the sub-device ioctls that modify the device state is
94	restricted. Refer to each individual subdevice ioctl documentation
95	for a description of which restrictions apply to a read-only sub-device.
96
97Return Value
98============
99
100On success 0 is returned, on error -1 and the ``errno`` variable is set
101appropriately. The generic error codes are described at the
102:ref:`Generic Error Codes <gen-errors>` chapter.
103
104ENOTTY
105    The device node is not a V4L2 sub-device.
106