1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2*01fae02dSMauro Carvalho Chehab.. c:namespace:: CEC 354f38fcaSMauro Carvalho Chehab 454f38fcaSMauro Carvalho Chehab.. _cec-func-ioctl: 554f38fcaSMauro Carvalho Chehab 654f38fcaSMauro Carvalho Chehab*********** 754f38fcaSMauro Carvalho Chehabcec ioctl() 854f38fcaSMauro Carvalho Chehab*********** 954f38fcaSMauro Carvalho Chehab 1054f38fcaSMauro Carvalho ChehabName 1154f38fcaSMauro Carvalho Chehab==== 1254f38fcaSMauro Carvalho Chehab 1354f38fcaSMauro Carvalho Chehabcec-ioctl - Control a cec device 1454f38fcaSMauro Carvalho Chehab 1554f38fcaSMauro Carvalho ChehabSynopsis 1654f38fcaSMauro Carvalho Chehab======== 1754f38fcaSMauro Carvalho Chehab 1854f38fcaSMauro Carvalho Chehab.. code-block:: c 1954f38fcaSMauro Carvalho Chehab 2054f38fcaSMauro Carvalho Chehab #include <sys/ioctl.h> 2154f38fcaSMauro Carvalho Chehab 22*01fae02dSMauro Carvalho Chehab``int ioctl(int fd, int request, void *argp)`` 2354f38fcaSMauro Carvalho Chehab 2454f38fcaSMauro Carvalho ChehabArguments 2554f38fcaSMauro Carvalho Chehab========= 2654f38fcaSMauro Carvalho Chehab 2754f38fcaSMauro Carvalho Chehab``fd`` 28*01fae02dSMauro Carvalho Chehab File descriptor returned by :c:func:`open()`. 2954f38fcaSMauro Carvalho Chehab 3054f38fcaSMauro Carvalho Chehab``request`` 3154f38fcaSMauro Carvalho Chehab CEC ioctl request code as defined in the cec.h header file, for 3254f38fcaSMauro Carvalho Chehab example :ref:`CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`. 3354f38fcaSMauro Carvalho Chehab 3454f38fcaSMauro Carvalho Chehab``argp`` 3554f38fcaSMauro Carvalho Chehab Pointer to a request-specific structure. 3654f38fcaSMauro Carvalho Chehab 3754f38fcaSMauro Carvalho ChehabDescription 3854f38fcaSMauro Carvalho Chehab=========== 3954f38fcaSMauro Carvalho Chehab 40*01fae02dSMauro Carvalho ChehabThe :c:func:`ioctl()` function manipulates cec device parameters. The 4154f38fcaSMauro Carvalho Chehabargument ``fd`` must be an open file descriptor. 4254f38fcaSMauro Carvalho Chehab 4354f38fcaSMauro Carvalho ChehabThe ioctl ``request`` code specifies the cec function to be called. It 4454f38fcaSMauro Carvalho Chehabhas encoded in it whether the argument is an input, output or read/write 4554f38fcaSMauro Carvalho Chehabparameter, and the size of the argument ``argp`` in bytes. 4654f38fcaSMauro Carvalho Chehab 4754f38fcaSMauro Carvalho ChehabMacros and structures definitions specifying cec ioctl requests and 4854f38fcaSMauro Carvalho Chehabtheir parameters are located in the cec.h header file. All cec ioctl 4954f38fcaSMauro Carvalho Chehabrequests, their respective function and parameters are specified in 5054f38fcaSMauro Carvalho Chehab:ref:`cec-user-func`. 5154f38fcaSMauro Carvalho Chehab 5254f38fcaSMauro Carvalho ChehabReturn Value 5354f38fcaSMauro Carvalho Chehab============ 5454f38fcaSMauro Carvalho Chehab 5554f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set 5654f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the 5754f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 5854f38fcaSMauro Carvalho Chehab 5954f38fcaSMauro Carvalho ChehabRequest-specific error codes are listed in the individual requests 6054f38fcaSMauro Carvalho Chehabdescriptions. 6154f38fcaSMauro Carvalho Chehab 6254f38fcaSMauro Carvalho ChehabWhen an ioctl that takes an output or read/write parameter fails, the 6354f38fcaSMauro Carvalho Chehabparameter remains unmodified. 64