Merge tag 'powerpc-4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[sfrench/cifs-2.6.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 .. c:function:: int ioctl( int fd, int request, void *argp )
23    :name: cec-ioctl
24
25 Arguments
26 =========
27
28 ``fd``
29     File descriptor returned by :c:func:`open() <cec-open>`.
30
31 ``request``
32     CEC ioctl request code as defined in the cec.h header file, for
33     example :ref:`CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`.
34
35 ``argp``
36     Pointer to a request-specific structure.
37
38
39 Description
40 ===========
41
42 The :c:func:`ioctl() <cec-ioctl>` function manipulates cec device parameters. The
43 argument ``fd`` must be an open file descriptor.
44
45 The ioctl ``request`` code specifies the cec function to be called. It
46 has encoded in it whether the argument is an input, output or read/write
47 parameter, and the size of the argument ``argp`` in bytes.
48
49 Macros and structures definitions specifying cec ioctl requests and
50 their parameters are located in the cec.h header file. All cec ioctl
51 requests, their respective function and parameters are specified in
52 :ref:`cec-user-func`.
53
54
55 Return Value
56 ============
57
58 On success 0 is returned, on error -1 and the ``errno`` variable is set
59 appropriately. The generic error codes are described at the
60 :ref:`Generic Error Codes <gen-errors>` chapter.
61
62 Request-specific error codes are listed in the individual requests
63 descriptions.
64
65 When an ioctl that takes an output or read/write parameter fails, the
66 parameter remains unmodified.