gpio-get-lineinfo-watch-ioctl.rst 2.1 KB

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