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:
- How does
gpiomonmonitor events? Polling or interrupt? If it's interrupt based, how doesgpiomonget to know which interrupt line is there for this GPIO? - Is there any dependency on pinctrl? Like do I need to configure the pin something like external interrupt to make it work with
gpiomon?
