2 slbl backlight utility for Sharp Zaurus
4 Copyright 2004 Michael 'Mickey' Lauer <mickey@Vanille.de>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
20 #include <sys/ioctl.h>
21 #include <sys/types.h>
27 #define SHARP_FL_IOCTL_DEVICE "/dev/sharp_fl"
28 #define SHARP_FL_IOCTL_ON 1
29 #define SHARP_FL_IOCTL_OFF 2
30 #define SHARP_FL_IOCTL_STEP_CONTRAST 100
31 #define SHARP_FL_IOCTL_GET_STEP_CONTRAST 101
32 #define SHARP_FL_IOCTL_GET_STEP 102
34 int main(int argc, char *argv[])
41 fd = open( SHARP_FL_IOCTL_DEVICE, O_RDWR );
42 steps = ioctl( fd, SHARP_FL_IOCTL_GET_STEP, 0 );
46 perror( "SHARP_FL_IOCTL_GET_STEP: ");
50 current = ioctl( fd, SHARP_FL_IOCTL_GET_STEP_CONTRAST, 0 );
54 printf( "Current backlight setting = %d / %d\n", current, steps-1 );
56 else if (strcmp(argv[1], "on") == 0)
58 ioctl( fd, SHARP_FL_IOCTL_ON, 0 );
60 else if (strcmp(argv[1], "off") == 0)
62 ioctl( fd, SHARP_FL_IOCTL_OFF, 0 );
64 else if (sscanf(argv[1], "%d", &new) == 1)
66 printf( "Setting backlight to %d\n", new );
67 ioctl( fd, SHARP_FL_IOCTL_STEP_CONTRAST, new );
71 printf( "Usage:\n%s [on|off|<num>]\n", argv[0]);