xref: /linux/Documentation/userspace-api/media/v4l/vidioc-subdev-g-client-cap.rst (revision f57fa2959244026ea5e885249e6c55fe3f133bd7)
1*f57fa295STomi Valkeinen.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*f57fa295STomi Valkeinen.. c:namespace:: V4L
3*f57fa295STomi Valkeinen
4*f57fa295STomi Valkeinen.. _VIDIOC_SUBDEV_G_CLIENT_CAP:
5*f57fa295STomi Valkeinen
6*f57fa295STomi Valkeinen************************************************************
7*f57fa295STomi Valkeinenioctl VIDIOC_SUBDEV_G_CLIENT_CAP, VIDIOC_SUBDEV_S_CLIENT_CAP
8*f57fa295STomi Valkeinen************************************************************
9*f57fa295STomi Valkeinen
10*f57fa295STomi ValkeinenName
11*f57fa295STomi Valkeinen====
12*f57fa295STomi Valkeinen
13*f57fa295STomi ValkeinenVIDIOC_SUBDEV_G_CLIENT_CAP - VIDIOC_SUBDEV_S_CLIENT_CAP - Get or set client
14*f57fa295STomi Valkeinencapabilities.
15*f57fa295STomi Valkeinen
16*f57fa295STomi ValkeinenSynopsis
17*f57fa295STomi Valkeinen========
18*f57fa295STomi Valkeinen
19*f57fa295STomi Valkeinen.. c:macro:: VIDIOC_SUBDEV_G_CLIENT_CAP
20*f57fa295STomi Valkeinen
21*f57fa295STomi Valkeinen``int ioctl(int fd, VIDIOC_SUBDEV_G_CLIENT_CAP, struct v4l2_subdev_client_capability *argp)``
22*f57fa295STomi Valkeinen
23*f57fa295STomi Valkeinen.. c:macro:: VIDIOC_SUBDEV_S_CLIENT_CAP
24*f57fa295STomi Valkeinen
25*f57fa295STomi Valkeinen``int ioctl(int fd, VIDIOC_SUBDEV_S_CLIENT_CAP, struct v4l2_subdev_client_capability *argp)``
26*f57fa295STomi Valkeinen
27*f57fa295STomi ValkeinenArguments
28*f57fa295STomi Valkeinen=========
29*f57fa295STomi Valkeinen
30*f57fa295STomi Valkeinen``fd``
31*f57fa295STomi Valkeinen    File descriptor returned by :ref:`open() <func-open>`.
32*f57fa295STomi Valkeinen
33*f57fa295STomi Valkeinen``argp``
34*f57fa295STomi Valkeinen    Pointer to struct :c:type:`v4l2_subdev_client_capability`.
35*f57fa295STomi Valkeinen
36*f57fa295STomi ValkeinenDescription
37*f57fa295STomi Valkeinen===========
38*f57fa295STomi Valkeinen
39*f57fa295STomi ValkeinenThese ioctls are used to get and set the client (the application using the
40*f57fa295STomi Valkeinensubdevice ioctls) capabilities. The client capabilities are stored in the file
41*f57fa295STomi Valkeinenhandle of the opened subdev device node, and the client must set the
42*f57fa295STomi Valkeinencapabilities for each opened subdev separately.
43*f57fa295STomi Valkeinen
44*f57fa295STomi ValkeinenBy default no client capabilities are set when a subdev device node is opened.
45*f57fa295STomi Valkeinen
46*f57fa295STomi ValkeinenThe purpose of the client capabilities are to inform the kernel of the behavior
47*f57fa295STomi Valkeinenof the client, mainly related to maintaining compatibility with different
48*f57fa295STomi Valkeinenkernel and userspace versions.
49*f57fa295STomi Valkeinen
50*f57fa295STomi ValkeinenThe ``VIDIOC_SUBDEV_G_CLIENT_CAP`` ioctl returns the current client capabilities
51*f57fa295STomi Valkeinenassociated with the file handle ``fd``.
52*f57fa295STomi Valkeinen
53*f57fa295STomi ValkeinenThe ``VIDIOC_SUBDEV_S_CLIENT_CAP`` ioctl sets client capabilities for the file
54*f57fa295STomi Valkeinenhandle ``fd``. The new capabilities fully replace the current capabilities, the
55*f57fa295STomi Valkeinenioctl can therefore also be used to remove capabilities that have previously
56*f57fa295STomi Valkeinenbeen set.
57*f57fa295STomi Valkeinen
58*f57fa295STomi Valkeinen``VIDIOC_SUBDEV_S_CLIENT_CAP`` modifies the struct
59*f57fa295STomi Valkeinen:c:type:`v4l2_subdev_client_capability` to reflect the capabilities that have
60*f57fa295STomi Valkeinenbeen accepted. A common case for the kernel not accepting a capability is that
61*f57fa295STomi Valkeinenthe kernel is older than the headers the userspace uses, and thus the capability
62*f57fa295STomi Valkeinenis unknown to the kernel.
63*f57fa295STomi Valkeinen
64*f57fa295STomi Valkeinen.. flat-table:: Client Capabilities
65*f57fa295STomi Valkeinen    :header-rows:  1
66*f57fa295STomi Valkeinen
67*f57fa295STomi Valkeinen    * - Capability
68*f57fa295STomi Valkeinen      - Description
69*f57fa295STomi Valkeinen    * - ``V4L2_SUBDEV_CLIENT_CAP_STREAMS``
70*f57fa295STomi Valkeinen      - The client is aware of streams. Setting this flag enables the use
71*f57fa295STomi Valkeinen        of 'stream' fields (referring to the stream number) with various
72*f57fa295STomi Valkeinen        ioctls. If this is not set (which is the default), the 'stream' fields
73*f57fa295STomi Valkeinen        will be forced to 0 by the kernel.
74*f57fa295STomi Valkeinen
75*f57fa295STomi ValkeinenReturn Value
76*f57fa295STomi Valkeinen============
77*f57fa295STomi Valkeinen
78*f57fa295STomi ValkeinenOn success 0 is returned, on error -1 and the ``errno`` variable is set
79*f57fa295STomi Valkeinenappropriately. The generic error codes are described at the
80*f57fa295STomi Valkeinen:ref:`Generic Error Codes <gen-errors>` chapter.
81*f57fa295STomi Valkeinen
82*f57fa295STomi ValkeinenENOIOCTLCMD
83*f57fa295STomi Valkeinen   The kernel does not support this ioctl.
84