gpio-v2-get-lineinfo-watch-ioctl.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. .. SPDX-License-Identifier: GPL-2.0
  2. .. _GPIO_V2_GET_LINEINFO_WATCH_IOCTL:
  3. ********************************
  4. GPIO_V2_GET_LINEINFO_WATCH_IOCTL
  5. ********************************
  6. Name
  7. ====
  8. GPIO_V2_GET_LINEINFO_WATCH_IOCTL - Enable watching a line for changes to its
  9. request state and configuration information.
  10. Synopsis
  11. ========
  12. .. c:macro:: GPIO_V2_GET_LINEINFO_WATCH_IOCTL
  13. ``int ioctl(int chip_fd, GPIO_V2_GET_LINEINFO_WATCH_IOCTL, struct gpio_v2_line_info *info)``
  14. Arguments
  15. =========
  16. ``chip_fd``
  17. The file descriptor of the GPIO character device returned by `open()`.
  18. ``info``
  19. The :c:type:`line_info<gpio_v2_line_info>` struct to be populated, with
  20. the ``offset`` set to indicate the line to watch
  21. Description
  22. ===========
  23. Enable watching a line for changes to its request state and configuration
  24. information. Changes to line info include a line being requested, released
  25. or reconfigured.
  26. .. note::
  27. Watching line info is not generally required, and would typically only be
  28. used by a system monitoring component.
  29. The line info does NOT include the line value.
  30. The line must be requested using gpio-v2-get-line-ioctl.rst to access
  31. its value, and the line request can monitor a line for events using
  32. gpio-v2-line-event-read.rst.
  33. By default all lines are unwatched when the GPIO chip is opened.
  34. Multiple lines may be watched simultaneously by adding a watch for each.
  35. Once a watch is set, any changes to line info will generate events which can be
  36. read from the ``chip_fd`` as described in
  37. gpio-v2-lineinfo-changed-read.rst.
  38. Adding a watch to a line that is already watched is an error (**EBUSY**).
  39. Watches are specific to the ``chip_fd`` and are independent of watches
  40. on the same GPIO chip opened with a separate call to `open()`.
  41. Return Value
  42. ============
  43. On success 0 and ``info`` is populated with the current line info.
  44. On error -1 and the ``errno`` variable is set appropriately.
  45. Common error codes are described in error-codes.rst.