#!/usr/bin/perl use Inline C; use strict; toggle_lights(); __END__ __C__ #include #include #include #include #include #define ERROR -1 void toggle_lights() { int fd; int i = 0; long int orig = 0; if ((fd = open("/dev/console", O_NOCTTY)) == ERROR) { perror("cannot open console"); exit(ERROR); } ioctl(fd, KDGETLED, &orig); i |= LED_NUM; ioctl(fd, KDSETLED, i); sleep( 2 ); i = 0; i |= LED_CAP; ioctl(fd, KDSETLED, i); sleep( 2 ); i = 0; i |= LED_SCR; ioctl(fd, KDSETLED, i); sleep( 2 ); ioctl(fd, KDSETLED, orig); }