cec-func-ioctl.rst 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. .. -*- coding: utf-8; mode: rst -*-
  2. .. _cec-func-ioctl:
  3. ***********
  4. cec ioctl()
  5. ***********
  6. Name
  7. ====
  8. cec-ioctl - Control a cec device
  9. Synopsis
  10. ========
  11. .. code-block:: c
  12. #include <sys/ioctl.h>
  13. .. c:function:: int ioctl( int fd, int request, void *argp )
  14. :name: cec-ioctl
  15. Arguments
  16. =========
  17. ``fd``
  18. File descriptor returned by :c:func:`open() <cec-open>`.
  19. ``request``
  20. CEC ioctl request code as defined in the cec.h header file, for
  21. example :c:func:`CEC_ADAP_G_CAPS`.
  22. ``argp``
  23. Pointer to a request-specific structure.
  24. Description
  25. ===========
  26. .. note::
  27. This documents the proposed CEC API. This API is not yet finalized
  28. and is currently only available as a staging kernel module.
  29. The :c:func:`ioctl()` function manipulates cec device parameters. The
  30. argument ``fd`` must be an open file descriptor.
  31. The ioctl ``request`` code specifies the cec function to be called. It
  32. has encoded in it whether the argument is an input, output or read/write
  33. parameter, and the size of the argument ``argp`` in bytes.
  34. Macros and structures definitions specifying cec ioctl requests and
  35. their parameters are located in the cec.h header file. All cec ioctl
  36. requests, their respective function and parameters are specified in
  37. :ref:`cec-user-func`.
  38. Return Value
  39. ============
  40. On success 0 is returned, on error -1 and the ``errno`` variable is set
  41. appropriately. The generic error codes are described at the
  42. :ref:`Generic Error Codes <gen-errors>` chapter.
  43. Request-specific error codes are listed in the individual requests
  44. descriptions.
  45. When an ioctl that takes an output or read/write parameter fails, the
  46. parameter remains unmodified.