Merge remote-tracking branch 'docs-next/docs-next' into devel/docs-next
[cascardo/linux.git] / Documentation / media / uapi / cec / cec-func-ioctl.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _cec-func-ioctl:
4
5 ***********
6 cec ioctl()
7 ***********
8
9 Name
10 ====
11
12 cec-ioctl - Control a cec device
13
14 Synopsis
15 ========
16
17 .. code-block:: c
18
19     #include <sys/ioctl.h>
20
21
22 .. cpp:function:: int ioctl( int fd, int request, void *argp )
23
24 Arguments
25 =========
26
27 ``fd``
28     File descriptor returned by :ref:`open() <func-open>`.
29
30 ``request``
31     CEC ioctl request code as defined in the cec.h header file, for
32     example :ref:`CEC_ADAP_G_CAPS`.
33
34 ``argp``
35     Pointer to a request-specific structure.
36
37
38 Description
39 ===========
40
41 .. note::
42
43    This documents the proposed CEC API. This API is not yet finalized
44    and is currently only available as a staging kernel module.
45
46 The :c:func:`ioctl()` function manipulates cec device parameters. The
47 argument ``fd`` must be an open file descriptor.
48
49 The ioctl ``request`` code specifies the cec function to be called. It
50 has encoded in it whether the argument is an input, output or read/write
51 parameter, and the size of the argument ``argp`` in bytes.
52
53 Macros and structures definitions specifying cec ioctl requests and
54 their parameters are located in the cec.h header file. All cec ioctl
55 requests, their respective function and parameters are specified in
56 :ref:`cec-user-func`.
57
58
59 Return Value
60 ============
61
62 On success 0 is returned, on error -1 and the ``errno`` variable is set
63 appropriately. The generic error codes are described at the
64 :ref:`Generic Error Codes <gen-errors>` chapter.
65
66 Request-specific error codes are listed in the individual requests
67 descriptions.
68
69 When an ioctl that takes an output or read/write parameter fails, the
70 parameter remains unmodified.