blob: 2410fef1471c04dd7814491650e34312974c51fe (
plain)
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
|
#include <unistd.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/random.h>
#define LED_FILE "/sys/devices/platform/thinkpad_acpi/leds/tpacpi::lid_logo_dot/brightness"
int main(void) {
int fd_led;
uint32_t r[1];
fd_led = open(LED_FILE, O_WRONLY);
if (fd_led == -1) {
write(2,"Can't open led control file.\n",29);
return -1;
}
while(1) {
usleep(50000);
write(fd_led,"0",2);
getrandom(r, sizeof(*r), GRND_NONBLOCK);
usleep(*r&0x001fffff);
write(fd_led,"255",4);
}
return 0;
}
|