18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_SUBDEV_QUERYCAP:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci****************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_SUBDEV_QUERYCAP
88c2ecf20Sopenharmony_ci****************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_SUBDEV_QUERYCAP - Query sub-device capabilities
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_QUERYCAP
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_QUERYCAP, struct v4l2_subdev_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_subdev_capability`.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDescription
328c2ecf20Sopenharmony_ci===========
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciAll V4L2 sub-devices support the ``VIDIOC_SUBDEV_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 pointer to
378c2ecf20Sopenharmony_cia struct :c:type:`v4l2_subdev_capability` which is filled by the driver. When
388c2ecf20Sopenharmony_cithe driver is not compatible with this specification the ioctl returns
398c2ecf20Sopenharmony_ci``ENOTTY`` error code.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{1.5cm}|p{2.5cm}|p{13cm}|
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci.. c:type:: v4l2_subdev_capability
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_subdev_capability
468c2ecf20Sopenharmony_ci    :header-rows:  0
478c2ecf20Sopenharmony_ci    :stub-columns: 0
488c2ecf20Sopenharmony_ci    :widths:       3 4 20
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci    * - __u32
518c2ecf20Sopenharmony_ci      - ``version``
528c2ecf20Sopenharmony_ci      - Version number of the driver.
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci	The version reported is provided by the V4L2 subsystem following the
558c2ecf20Sopenharmony_ci	kernel numbering scheme. However, it may not always return the same
568c2ecf20Sopenharmony_ci	version as the kernel if, for example, a stable or
578c2ecf20Sopenharmony_ci	distribution-modified kernel uses the V4L2 stack from a newer kernel.
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	The version number is formatted using the ``KERNEL_VERSION()``
608c2ecf20Sopenharmony_ci	macro:
618c2ecf20Sopenharmony_ci    * - :cspan:`2`
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci	``__u32 version = KERNEL_VERSION(0, 8, 1);``
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci	``printf ("Version: %u.%u.%u\\n",``
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
708c2ecf20Sopenharmony_ci    * - __u32
718c2ecf20Sopenharmony_ci      - ``capabilities``
728c2ecf20Sopenharmony_ci      - Sub-device capabilities of the opened device, see
738c2ecf20Sopenharmony_ci	:ref:`subdevice-capabilities`.
748c2ecf20Sopenharmony_ci    * - __u32
758c2ecf20Sopenharmony_ci      - ``reserved``\ [14]
768c2ecf20Sopenharmony_ci      - Reserved for future extensions. Set to 0 by the V4L2 core.
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6cm}|p{2.2cm}|p{8.8cm}|
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci.. _subdevice-capabilities:
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci.. cssclass:: longtable
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci.. flat-table:: Sub-Device Capabilities Flags
858c2ecf20Sopenharmony_ci    :header-rows:  0
868c2ecf20Sopenharmony_ci    :stub-columns: 0
878c2ecf20Sopenharmony_ci    :widths:       3 1 4
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci    * - V4L2_SUBDEV_CAP_RO_SUBDEV
908c2ecf20Sopenharmony_ci      - 0x00000001
918c2ecf20Sopenharmony_ci      - The sub-device device node is registered in read-only mode.
928c2ecf20Sopenharmony_ci	Access to the sub-device ioctls that modify the device state is
938c2ecf20Sopenharmony_ci	restricted. Refer to each individual subdevice ioctl documentation
948c2ecf20Sopenharmony_ci	for a description of which restrictions apply to a read-only sub-device.
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ciReturn Value
978c2ecf20Sopenharmony_ci============
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
1008c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
1018c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ciENOTTY
1048c2ecf20Sopenharmony_ci    The device node is not a V4L2 sub-device.
105