From 5e4cc437931fb429f9187523de1cfac93e2cb80e Mon Sep 17 00:00:00 2001 From: root Date: Mon, 28 Dec 2015 11:28:47 +0000 Subject: add led and front-light tools --- led.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 led.c (limited to 'led.c') diff --git a/led.c b/led.c new file mode 100644 index 0000000..0297a77 --- /dev/null +++ b/led.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include + +#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); + +} -- cgit v1.2.3