/*Spiros Ioannou (sivann at theseas.ntua.gr) * flash sun keyboard lights in sequence */ #include #include #include #include #include #include main() { int fd; int i=1; char c; if((fd = open("/dev/kbd", 0)) == -1) { fprintf(stderr, "Cant open device\n"); exit(2); } while(1){ c=LED_CAPS_LOCK; if (ioctl(fd, KIOCSLED, &c)==-1) perror("ioctl"); c=LED_COMPOSE; if (ioctl(fd, KIOCSLED, &c)==-1) perror("ioctl"); c=LED_SCROLL_LOCK; if (ioctl(fd, KIOCSLED, &c)==-1) perror("ioctl"); c=LED_NUM_LOCK; if (ioctl(fd, KIOCSLED, &c)==-1) perror("ioctl"); c=LED_NUM_LOCK; if (ioctl(fd, KIOCSLED, &c)==-1) perror("ioctl"); c=LED_SCROLL_LOCK; if (ioctl(fd, KIOCSLED, &c)==-1) perror("ioctl"); c=LED_COMPOSE; if (ioctl(fd, KIOCSLED, &c)==-1) perror("ioctl"); c=LED_CAPS_LOCK; if (ioctl(fd, KIOCSLED, &c)==-1) perror("ioctl"); c=(!LED_CAPS_LOCK); if (ioctl(fd, KIOCSLED, &c)==-1) perror("ioctl"); sleep(1); } }