the GPIO subsystem on the Raspberry allows to set pins for "interrupt" the created subsystem file becomes readable on any level change. Unfortunately I could not coerce tcl to ignore the eof condition. So I expanded the sampel c programm to handle multiple pins set up for interrupt notice to be watched over and handed in to a tcl file input. the helper will first iterate over all configured inputs and report their current state. then one line will be output for every event seen. : Useage example ( here the gpio 23, 24 and 25 ) : ====== # config input: proc Uevent fd { set line [gets $fd] puts stderr line:>>$line<< switch -- $line \ 23:0 { hands right } 23:1 { hands right 0 } 24:0 { hands left } 24:1 { hands left 0 } 25:0 { puts stderr Release } 25:1 { set ::stop [ clock milliseconds ] incr ::cont } default { } } set fd [ open "| ./gpioirq 23 24 25" RDONLY ] fconfigure $fd -buffering none fileevent $fd readable [list Uevent $fd] ======== Then create a fileevent readable for $fd. ==== fileevent $fd readable [list Uevent $fd] ====== ./gpioirq.c slightly expanded from an example give on the gpio project page. ====== // adapted from an example. // i2016 Uwe Klein Habertwedt #include #include #include #include #include #define GPIO_FN_MAXLEN 32 #define POLL_TIMEOUT 1000 #define RDBUF_LEN 5 int main(int argc, char **argv) { char fn[GPIO_FN_MAXLEN]; int fd[argc],ret, arg; struct pollfd pfd[argc]; char rdbuf[RDBUF_LEN]; memset(rdbuf, 0x00, RDBUF_LEN); memset(fn, 0x00, GPIO_FN_MAXLEN); if(argc<2) { printf("Usage: %s \nGPIO must be exported to sysfs and have enabled edge detection\n", argv[0]); return 1; } for (arg=1;(arg>Enter Category Here