Notify gpio interrupt to user space from a kernel module

user1867459 picture user1867459 · Nov 6, 2013 · Viewed 9.4k times · Source

I have a code which detects GPIO interrupt in a kernel module. Now,I am looking for a mechanism to notify user space upon detecting gpio interrupt from kernel module. Any example / code snippet with certain advantages/disadvantages over different options? I would appreciate your response.

Answer

Ortwin Angermeier picture Ortwin Angermeier · Nov 6, 2013

Take a look at the GPIO keyboard driver (drivers/input/keyboard/gpio_keys.c). It is a good starting point for your problem.

In the userspace you then listen (some blocking read for example, or just tail to test) to /dev/input/yourevent for events.