1.. -*- coding: utf-8; mode: rst -*-
2
3.. _cec-func-ioctl:
4
5***********
6cec ioctl()
7***********
8
9Name
10====
11
12cec-ioctl - Control a cec device
13
14Synopsis
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
25Arguments
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
39Description
40===========
41
42The :c:func:`ioctl() <cec-ioctl>` function manipulates cec device parameters. The
43argument ``fd`` must be an open file descriptor.
44
45The ioctl ``request`` code specifies the cec function to be called. It
46has encoded in it whether the argument is an input, output or read/write
47parameter, and the size of the argument ``argp`` in bytes.
48
49Macros and structures definitions specifying cec ioctl requests and
50their parameters are located in the cec.h header file. All cec ioctl
51requests, their respective function and parameters are specified in
52:ref:`cec-user-func`.
53
54
55Return Value
56============
57
58On success 0 is returned, on error -1 and the ``errno`` variable is set
59appropriately. The generic error codes are described at the
60:ref:`Generic Error Codes <gen-errors>` chapter.
61
62Request-specific error codes are listed in the individual requests
63descriptions.
64
65When an ioctl that takes an output or read/write parameter fails, the
66parameter remains unmodified.
67