gpio-handle-get-line-values-ioctl.rst 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. .. SPDX-License-Identifier: GPL-2.0
  2. .. _GPIOHANDLE_GET_LINE_VALUES_IOCTL:
  3. ********************************
  4. GPIOHANDLE_GET_LINE_VALUES_IOCTL
  5. ********************************
  6. .. warning::
  7. This ioctl is part of chardev_v1.rst and is obsoleted by
  8. gpio-v2-line-get-values-ioctl.rst.
  9. Name
  10. ====
  11. GPIOHANDLE_GET_LINE_VALUES_IOCTL - Get the values of all requested lines.
  12. Synopsis
  13. ========
  14. .. c:macro:: GPIOHANDLE_GET_LINE_VALUES_IOCTL
  15. ``int ioctl(int handle_fd, GPIOHANDLE_GET_LINE_VALUES_IOCTL, struct gpiohandle_data *values)``
  16. Arguments
  17. =========
  18. ``handle_fd``
  19. The file descriptor of the GPIO character device, as returned in the
  20. :c:type:`request.fd<gpiohandle_request>` by gpio-get-linehandle-ioctl.rst.
  21. ``values``
  22. The :c:type:`line_values<gpiohandle_data>` to be populated.
  23. Description
  24. ===========
  25. Get the values of all requested lines.
  26. The values returned are logical, indicating if the line is active or inactive.
  27. The ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` flag controls the mapping between physical
  28. values (high/low) and logical values (active/inactive).
  29. If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is not set then high is active and
  30. low is inactive. If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is set then low is active
  31. and high is inactive.
  32. The values of both input and output lines may be read.
  33. For output lines, the value returned is driver and configuration dependent and
  34. may be either the output buffer (the last requested value set) or the input
  35. buffer (the actual level of the line), and depending on the hardware and
  36. configuration these may differ.
  37. This ioctl can also be used to read the line value for line events,
  38. substituting the ``event_fd`` for the ``handle_fd``. As there is only
  39. one line requested in that case, only the one value is returned in ``values``.
  40. Return Value
  41. ============
  42. On success 0 and ``values`` populated with the values read.
  43. On error -1 and the ``errno`` variable is set appropriately.
  44. Common error codes are described in error-codes.rst.