main.lv
Dont think code it

2009-12-12 Linux keyboard LED

Send some bytes and flash LED on you keyboards.Run it under root.
There will no be any errors if something happens.

Usage:

./kbled [NumLock] [CapsLock] [ScrLock]

./kbled 0 0 0


#include <stdlib.h>
#include <fcntl.h>
#include <sys/syscall.h>
#include <linux/kd.h>

int main( int argc , char **argv )
{
	int rc,i;
	if (argc != 4) exit(0);

	rc = syscall(SYS_open,"/dev/console",O_WRONLY,7*64+7*8+7); //open cosole
	if (rc == 0) rc = 1;
	
	i = (argv[1][0]-'0')*2+(argv[2][0]-'0')*4+(argv[3][0]-'0');
	ioctl( rc , KDSETLED , i );
	
	return 0;
}




Downloads

kbled.tar.gz1KiB