I am trying to monitor a GPIO pin using libgpiod tools. The pinctrl has configured the pin as GPIO ACTIVE_LOW PULL-DOWN. Now when I read the pin using gpioget 0 5, I see the correct value getting retreived. So I expect the gpiomon to work the same way, i.e. whenever there is change in value (or rising-edge / falling-edge), the gpiomon 0 5 should show those events. But it does not, instead it shows nothing. Even when I read GPIO value using sysfs (export GPIO pin and read its value) it shows correct value.

When I run gpiomon with strace, I can see the timeout being reached and it keeps polling the GPIO pin.

mmap(0x6f6040b000, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x6f6040b000 prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x6f6040b000, 262144, "scudo:primary") = 0 ioctl(3, GPIO_GET_CHIPINFO_IOCTL, 0x7fc77d6ba0) = 0 mmap(0x702040e000, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x702040e000 prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x702040e000, 262144, "scudo:primary") = 0 ioctl(3, _IOC(_IOC_READ|_IOC_WRITE, 0xb4, 0x5, 0x100), 0x7fc77d6ab0) = 0 ioctl(3, _IOC(_IOC_READ|_IOC_WRITE, 0xb4, 0x7, 0x250), 0x7fc77d6990) = 0 ioctl(3, _IOC(_IOC_READ|_IOC_WRITE, 0xb4, 0x5, 0x100), 0x7fc77d6850) = 0 ppoll([{fd=4, events=POLLIN|POLLPRI}], 1, {tv_sec=10, tv_nsec=0}, NULL, 8) = 0 (Timeout) ppoll([{fd=4, events=POLLIN|POLLPRI}], 1, {tv_sec=10, tv_nsec=0}, NULL, 8) = 0 (Timeout) 

What I wanted to understand is:

  1. How does gpiomon monitor events? Polling or interrupt? If it's interrupt based, how does gpiomon get to know which interrupt line is there for this GPIO?
  2. Is there any dependency on pinctrl? Like do I need to configure the pin something like external interrupt to make it work with gpiomon?

[Edit 1] output of the gpiodetect and gpioinfo: enter image description here

8

Related questions 939 open() in Python does not create a file if it doesn't exist 762 How do I get cURL to not show the progress bar? 609 Linux: copy and create destination dir if it does not exist Related questions 939 open() in Python does not create a file if it doesn't exist 762 How do I get cURL to not show the progress bar? 609 Linux: copy and create destination dir if it does not exist 1 PHP CURL(7.48.0) DNS resolve in /etc/hosts 0 gpio pin is not exported in linux Load 2 more related questions Show fewer related questions

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.