/* Created by (C) Chester Kuo ,released under GPL * , drived from sa1100_frontligt.c! * * Test the LCD backlight/contrast[/frontlight] driver. */ #include #include #include #include #include #include #include #include "sa1100_frontlight.h" int main(void) { int i, fd, retval; int temp; fd = open ("/dev/sa1100-fl", O_WRONLY); if (fd == -1) { perror("/dev/sa1100-fl"); exit(errno); } printf("\n\t\t\tFrontlight Driver Test Example.\n\n"); for (i=0; i<5; i++) { printf("Turning OFF Frontlight...\n"); retval = ioctl(fd, _SA1100_FL_IOCTL_OFF, 0); if (retval == -1) { perror("ioctl"); exit(errno); } sleep(1); printf("Turning ON Frontlight...\n"); retval = ioctl(fd, _SA1100_FL_IOCTL_ON, 0); if (retval == -1) { perror("ioctl"); exit(errno); } sleep(1); } #if 0 printf("Turning OFF Frontlight...\n"); retval = ioctl(fd, _SA1100_FL_IOCTL_OFF, 0); if (retval == -1) { perror("ioctl"); exit(errno); } #endif printf("Testing the backlight from 1 to 100\n"); for (temp=0;temp<=100;temp++) retval = ioctl(fd,_SA1100_FL_IOCTL_BACKLIGHT,temp); if (retval == -1) { perror("error in ioctl at setting backlight\n"); exit(errno); } printf("Test the contrast from 1 to 100\n"); for (temp=0;temp<=100;temp++) retval = ioctl(fd,_SA1100_FL_IOCTL_CONTRAST,temp); if (retval == -1) { perror("error in ioctl at contrast \n"); exit(errno); } fprintf(stderr, "Done.\n"); }