Merge remote-tracking branches 'asoc/fix/max98371', 'asoc/fix/nau8825', 'asoc/fix...
[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:: This documents the proposed CEC API. This API is not yet finalized
42    and is currently only available as a staging kernel module.
43
44 The :c:func:`ioctl()` function manipulates cec device parameters. The
45 argument ``fd`` must be an open file descriptor.
46
47 The ioctl ``request`` code specifies the cec function to be called. It
48 has encoded in it whether the argument is an input, output or read/write
49 parameter, and the size of the argument ``argp`` in bytes.
50
51 Macros and structures definitions specifying cec ioctl requests and
52 their parameters are located in the cec.h header file. All cec ioctl
53 requests, their respective function and parameters are specified in
54 :ref:`cec-user-func`.
55
56
57 Return Value
58 ============
59
60 On success 0 is returned, on error -1 and the ``errno`` variable is set
61 appropriately. The generic error codes are described at the
62 :ref:`Generic Error Codes <gen-errors>` chapter.
63
64 Request-specific error codes are listed in the individual requests
65 descriptions.
66
67 When an ioctl that takes an output or read/write parameter fails, the
68 parameter remains unmodified.