summaryrefslogtreecommitdiff
path: root/md/writeup/linux_keyboard_led.md
blob: 721724496d9c889e64f84c0caff9888d852e2e1a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
title: Linux keyboard LED
keywords: linux,keyboard,led

# 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
```

```c
#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.gz -
1KiB - http://archive.main.lv/files/writeup/linux_keyboard_led/kbled.tar.gz