tan@infonode.ingr.com (Maribel Tan) (06/07/91)
POSTING FOR SOMEONE ------------------------------------------------- Here is a tiny utility for dimming the screen. You can set all parameters as you wish: dim time (in seconds), dim level, and brightness level. e.g. autodim b50 sets brightness to 50 autodim b returns the current brightness, so you can do stuff like setenv OLDBRIGHTNESS `autodim b` ... autodim b$OLDBRIGHTNESS setting all at once: autodim b50 d0 t60 t Sets brightness to 50, dim time to 60 seconds, dim level to 0, and returns old dim time. Enjoy! -------- cut here ------- /* autodim.c :- set autodimmer brighness level to zero */ /* Compile with: cc -g -O -object -o autodim autodim.c strip autodim Synopsis: autodim [b[<brightlevel>]] [d[<dimlevel>]] [t[<dimtime seconds>]] autodim a */ #include <nextdev/evsio.h> #include <libc.h> int main( int argc, char **argv) { int dimlevel,britelevel,dimtime; int odimlevel,obritelevel,odimtime; char *argptr,*name; int evs; name = argv[0]; if((evs = open("/dev/evs0",O_RDWR)) < 0){ perror("/dev/evs0"); exit(10); } ioctl(evs,EVSIOCB,&obritelevel); ioctl(evs,EVSIOCADB,&odimlevel); ioctl(evs,EVSIOCADT,&odimtime); while(--argc > 0){ argptr = *++argv; switch(*argptr++){ case 'b': case 'B': if(*argptr == 0){ printf("%d\n",obritelevel); exit(0); } britelevel = atoi(argptr); ioctl(evs,EVSIOSB,&britelevel); break; case 'd': case 'D': if(*argptr == 0){ printf("%d\n",odimlevel); exit(0); } dimlevel = atoi(argptr); ioctl(evs,EVSIOSADB,&dimlevel); break; case 't': case 'T': if(*argptr == 0){ printf("%d\n",odimtime/68); exit(0); } dimtime = atoi(argptr)*68; if(dimtime < 680) dimtime = 680; ioctl(evs,EVSIOSADT,&dimtime); break; case 'a': case 'A': printf("B%d D%d T%d\n",obritelevel,odimlevel,odimtime/68); break; default : fprintf(stderr,"Usage: %s [b[<brightlevel]] [d[<dimlevel>]] [t[<dimtime>]]\n",name); fprintf(stderr," or %s a\n",name); exit(10); } } exit(0); } --- JEROEN VANDER ZIJP E-Mail : jzijp@cs.uah.edu US-Mail: C.S. Dept. Univ. of Alabama/Huntsville, 515 Sparkman dr. Huntsville AL35899 Phone : (205)-895-6542