I tried the gpio-keys driver. I was able to count the interrupts, but was not able to determine which pin. I tried the following code, but when I hooked up switches to two pins the first switch I triggered would give the correct code, but when I triggered the second switch it would give the code for the first switch 4-5 times before it began giving the correct code.
using namespace std; volatile int fd1 = 0; volatile int counter1 = 0; volatile int code = 0; //volatile int value; FILE *ifp_gpio30_value; struct input_event event; void IRQHandler(int sig){ counter1 ++; read(fd1, &event, sizeof(struct input_event)); code = event.code; counter1 ++; } int main(void){ struct sigaction saio; fd1 = open("/dev/input/event1", O_RDWR|O_NONBLOCK); saio.sa_handler = IRQHandler; //saio.sa_mask = 0; saio.sa_flags = 0; saio.sa_restorer = NULL; sigaction(SIGIO,&saio,NULL); fcntl(fd1, F_SETOWN, getpid()); fcntl(fd1, F_SETFL, FASYNC); while(1){ cout << counter1; cout << "\t"; cout << code; cout << "\n"; } } -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.