Adding GPIO Button driver in kernel

I have an adapter board that I’ve got plugged into my beagleboard with a switch enabled on GPIO 130.

I can read the GPIO line successfully in user mode by using the technique described at http://wh1t3s.com/2009/05/14/reading-beagleboard-gpio/ but the only way I’m getting this information is by polling the pin state. My program goes off and may work on somethign for extended periods of time, and I’d rather deal with the button as if were a keyboard event, similar to monitoring the user button via the /dev/input/event0 interface.

I looked at http://ttkrpink.blogspot.com/2010/03/gpio-solution-found.html and by simply replacing the lines in arch/arm/mach-omap2/board-omap3beagle.c in the same way as he described I was able to get the event style interface, while losing that interface for the user button.

I thought I should be able to simply have two buttons declared in the gpio_buttons array, and I might get things the way I want, but I did not get an extra entry in the /dev/input directory.

Can someone steer me in the right direction to add a keyboard style interface to a GPIO button?

I’ve been chasing down another issue, and the answer just occurred to me. Adding a second button will not create a second entry in the /dev/input directory, but the key returned in the input event structure should be unique. From looking at the file linux-2.6.36/Documentation/input/input.txt and the structure below, the code would should be whichever button I’ve pressed or released.

struct input_event {
struct timeval time;
unsigned short type;
unsigned short code;
unsigned int value;
};