cec-func-ioctl.rst 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. The :c:func:`ioctl()` function manipulates cec device parameters. The
  27. argument ``fd`` must be an open file descriptor.
  28. The ioctl ``request`` code specifies the cec function to be called. It
  29. has encoded in it whether the argument is an input, output or read/write
  30. parameter, and the size of the argument ``argp`` in bytes.
  31. Macros and structures definitions specifying cec ioctl requests and
  32. their parameters are located in the cec.h header file. All cec ioctl
  33. requests, their respective function and parameters are specified in
  34. :ref:`cec-user-func`.
  35. Return Value
  36. ============
  37. On success 0 is returned, on error -1 and the ``errno`` variable is set
  38. appropriately. The generic error codes are described at the
  39. :ref:`Generic Error Codes <gen-errors>` chapter.
  40. Request-specific error codes are listed in the individual requests
  41. descriptions.
  42. When an ioctl that takes an output or read/write parameter fails, the
  43. parameter remains unmodified.