diff options
author | root <root@no.no.james.local> | 2015-12-28 11:28:47 +0000 |
---|---|---|
committer | root <root@no.no.james.local> | 2015-12-28 11:28:47 +0000 |
commit | 5e4cc437931fb429f9187523de1cfac93e2cb80e (patch) | |
tree | 424727e70ac954c42916e14c8c5661ff4af713ad /led.c | |
parent | 2ad7917a466655a2e8907ff73cdef4c8ea266872 (diff) | |
download | kobo-tools-5e4cc437931fb429f9187523de1cfac93e2cb80e.tar.gz kobo-tools-5e4cc437931fb429f9187523de1cfac93e2cb80e.tar.bz2 kobo-tools-5e4cc437931fb429f9187523de1cfac93e2cb80e.zip |
add led and front-light tools
Diffstat (limited to 'led.c')
-rw-r--r-- | led.c | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -0,0 +1,38 @@ +#include <fcntl.h> +#include <sys/ioctl.h> +#include <stdio.h> +#include <stdlib.h> + +#define CM_LED_BLINK 127 +#define CM_nLED 101 + +main (int argc, char *argv[]) +{ + int fd; + fd = open ("/dev/ntx_io", O_RDWR); + + if (argc != 2) { + printf ("Usage:\n%s {0|1}\n", argv[0]); + exit (1); + } + + switch (atoi (argv[1])) { + case 0: + ioctl (fd, CM_LED_BLINK, 0); + ioctl (fd, CM_nLED, 0); + break; + case 1: + ioctl (fd, CM_LED_BLINK, 0); + sleep (1); + ioctl (fd, CM_nLED, 1); + break; + case 2: + ioctl (fd, CM_LED_BLINK, 1); + break; + case 3: + ioctl (fd, CM_LED_BLINK, 2); + break; + } + exit (0); + +} |