Commit ebde7b062cd9e2ea968c93f23f73dd28c0a192d1

Authored by Bernhard Walle
Committed by Linus Torvalds
1 parent 09c9feb946

Documentation/gpio.txt: explain poll/select usage

Add a bit more information how to use poll(2) on GPIO value files
correctly. For me it was not clear that I need to poll(2) for
POLLPRI|POLLERR or select(2) for exceptfds.

Signed-off-by: Bernhard Walle <walle@corscience.de>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 10 additions and 0 deletions Side-by-side Diff

Documentation/gpio.txt
... ... @@ -617,6 +617,16 @@
617 617 is configured as an output, this value may be written;
618 618 any nonzero value is treated as high.
619 619  
  620 + If the pin can be configured as interrupt-generating interrupt
  621 + and if it has been configured to generate interrupts (see the
  622 + description of "edge"), you can poll(2) on that file and
  623 + poll(2) will return whenever the interrupt was triggered. If
  624 + you use poll(2), set the events POLLPRI and POLLERR. If you
  625 + use select(2), set the file descriptor in exceptfds. After
  626 + poll(2) returns, either lseek(2) to the beginning of the sysfs
  627 + file and read the new value or close the file and re-open it
  628 + to read the value.
  629 +
620 630 "edge" ... reads as either "none", "rising", "falling", or
621 631 "both". Write these strings to select the signal edge(s)
622 632 that will make poll(2) on the "value" file return.