Here's how you can do it with Inline under linux (the only OS I tested). You need the appropriate perms to the console so YMMV (also, most error checking removed for brevity sake).
(original Inline code)
-derby
Update: Whoa! I forgot that ioctl is normally available under
pure perl. I hade to steal the KD_* and LED_* constants from the include file but
it works fine.
(buggy pure perl code)
Update (again): Noticed a small bug in the above perl code when
resetting the lights back to original. Here it is again:
#!/usr/bin/perl
require "sys/ioctl.ph";
open( FH, "/dev/console" ) ||
die "cannot open console";
$KDSETLED = 0x4B32;
$KDGETLED = 0x4B31;
$LED_NUM = 0x02;
$LED_CAP = 0x04;
$LED_SCR = 0x01;
ioctl(FH, $KDGETLED, $orig);
@ary = unpack("ccccs",$orig);
foreach $state ( $LED_NUM, $LED_CAP, $LED_SCR, $ary[0] ) {
$i = 0;
$i |= $state;
ioctl(FH, $KDSETLED, $i);
sleep( 2 );
}
|