1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2*4882a593Smuzhiyun.. c:namespace:: CEC 3*4882a593Smuzhiyun 4*4882a593Smuzhiyun.. _cec-func-ioctl: 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun*********** 7*4882a593Smuzhiyuncec ioctl() 8*4882a593Smuzhiyun*********** 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunName 11*4882a593Smuzhiyun==== 12*4882a593Smuzhiyun 13*4882a593Smuzhiyuncec-ioctl - Control a cec device 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunSynopsis 16*4882a593Smuzhiyun======== 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun.. code-block:: c 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun #include <sys/ioctl.h> 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun``int ioctl(int fd, int request, void *argp)`` 23*4882a593Smuzhiyun 24*4882a593SmuzhiyunArguments 25*4882a593Smuzhiyun========= 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun``fd`` 28*4882a593Smuzhiyun File descriptor returned by :c:func:`open()`. 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun``request`` 31*4882a593Smuzhiyun CEC ioctl request code as defined in the cec.h header file, for 32*4882a593Smuzhiyun example :ref:`CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`. 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun``argp`` 35*4882a593Smuzhiyun Pointer to a request-specific structure. 36*4882a593Smuzhiyun 37*4882a593SmuzhiyunDescription 38*4882a593Smuzhiyun=========== 39*4882a593Smuzhiyun 40*4882a593SmuzhiyunThe :c:func:`ioctl()` function manipulates cec device parameters. The 41*4882a593Smuzhiyunargument ``fd`` must be an open file descriptor. 42*4882a593Smuzhiyun 43*4882a593SmuzhiyunThe ioctl ``request`` code specifies the cec function to be called. It 44*4882a593Smuzhiyunhas encoded in it whether the argument is an input, output or read/write 45*4882a593Smuzhiyunparameter, and the size of the argument ``argp`` in bytes. 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunMacros and structures definitions specifying cec ioctl requests and 48*4882a593Smuzhiyuntheir parameters are located in the cec.h header file. All cec ioctl 49*4882a593Smuzhiyunrequests, their respective function and parameters are specified in 50*4882a593Smuzhiyun:ref:`cec-user-func`. 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunReturn Value 53*4882a593Smuzhiyun============ 54*4882a593Smuzhiyun 55*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set 56*4882a593Smuzhiyunappropriately. The generic error codes are described at the 57*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter. 58*4882a593Smuzhiyun 59*4882a593SmuzhiyunRequest-specific error codes are listed in the individual requests 60*4882a593Smuzhiyundescriptions. 61*4882a593Smuzhiyun 62*4882a593SmuzhiyunWhen an ioctl that takes an output or read/write parameter fails, the 63*4882a593Smuzhiyunparameter remains unmodified. 64