how to detect a pin change of a GPIO on Linux board
问题 I am using 3.12 kernel on an ARM based linux board (imx233 CPU). My purpose is to detect pin change of a GPIO (1 to 0). I can read the pin value constantly calling the below function (in a while(1) loop) int GPIO_read_value(int pin){ int gpio_value = 0; char path[35] = {'\0'}; FILE *fp; sprintf(path, "/sys/class/gpio/gpio%d/value", pin); if ((fp = fopen(path,"rb+")) == NULL){ //echo in > direction //error } fscanf(fp, "%d", &gpio_value); fclose(fp); return gpio_value; } But it causes too much