1.. Permission is granted to copy, distribute and/or modify this 2.. document under the terms of the GNU Free Documentation License, 3.. Version 1.1 or any later version published by the Free Software 4.. Foundation, with no Invariant Sections, no Front-Cover Texts 5.. and no Back-Cover Texts. A copy of the license is included at 6.. Documentation/userspace-api/media/fdl-appendix.rst. 7.. 8.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections 9 10.. _cec-func-ioctl: 11 12*********** 13cec ioctl() 14*********** 15 16Name 17==== 18 19cec-ioctl - Control a cec device 20 21Synopsis 22======== 23 24.. code-block:: c 25 26 #include <sys/ioctl.h> 27 28 29.. c:function:: int ioctl( int fd, int request, void *argp ) 30 :name: cec-ioctl 31 32Arguments 33========= 34 35``fd`` 36 File descriptor returned by :c:func:`open() <cec-open>`. 37 38``request`` 39 CEC ioctl request code as defined in the cec.h header file, for 40 example :ref:`CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`. 41 42``argp`` 43 Pointer to a request-specific structure. 44 45 46Description 47=========== 48 49The :c:func:`ioctl() <cec-ioctl>` function manipulates cec device parameters. The 50argument ``fd`` must be an open file descriptor. 51 52The ioctl ``request`` code specifies the cec function to be called. It 53has encoded in it whether the argument is an input, output or read/write 54parameter, and the size of the argument ``argp`` in bytes. 55 56Macros and structures definitions specifying cec ioctl requests and 57their parameters are located in the cec.h header file. All cec ioctl 58requests, their respective function and parameters are specified in 59:ref:`cec-user-func`. 60 61 62Return Value 63============ 64 65On success 0 is returned, on error -1 and the ``errno`` variable is set 66appropriately. The generic error codes are described at the 67:ref:`Generic Error Codes <gen-errors>` chapter. 68 69Request-specific error codes are listed in the individual requests 70descriptions. 71 72When an ioctl that takes an output or read/write parameter fails, the 73parameter remains unmodified. 74