// XXX includes #include "consts.h" #include "config.h" #include "common.h" static pid_t light_pid; void on_press(void) { gettimeofday(last_press, NULL); kill(light_pid, SIGCONT); // XXX signal light thread } void keypress_thread(pid_t _light_pid) { light_pid = _light_pid; FILE* fp = fopen(KEYBOARD_FILE, "r"); fseek(fp, 0, SEEK_END); void* discard = malloc(KEYPRESS_SIZE); while (1) { fseek(fp, 0, SEEK_END); fread(discard, 1, KEYPRESS_SIZE, fp); on_press(); usleep(DEBOUNCE); } // XXX handle SIGINT or whatever __builtin_unreachable(); }