Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!decwrl!shelby!daemon From: lane@sumex-aim.stanford.edu (Christopher Lane) Newsgroups: comp.sys.next Subject: re: Screen dimming/burn in Message-ID: <1310@shelby.Stanford.EDU> Date: 8 Mar 90 01:17:26 GMT Sender: daemon@shelby.Stanford.EDU Lines: 60 In <12583@csli.Stanford.EDU>, dmr@csli.stanford.edu writes: >Is there a way we can 1) Dim the screen to 0% >automatically, instead of the 10% ot 20% it is now Below is the source code for 'bright.c' a utility that I originally wrote for 0.8 & 0.9 which I've updated for 1.0 though it's slightly less functional (it can't query the current setting due to changes by NeXT). To totally dim the screen, you can use something like: if ( -o /dev/console ) bright 0 in your personal .logout file or in the /etc/logout.std file. Or you could use something like: if ( "`who | grep 'console'`" != '' ) bright 0 in a 'cron' entry/script that runs every hour, but I've not tested this. - Christopher #include #include #include #include #define BRIGHT_MAX 0x3d /* MIN & MAX from */ #define BRIGHT_DEF 0x1f #define BRIGHT_MIN 0x00 typedef enum { PROGRAM, VALUE, ARGC } ARGUMENTS; void error(char *string) { perror(string); exit(EXIT_FAILURE); } void main(int argc, char *argv[]) { int value, device; if(argc != ARGC) { fprintf(stderr, "Usage: %s value (%d <= value <= %d)\n", argv[PROGRAM], BRIGHT_MIN, BRIGHT_MAX); exit(EXIT_FAILURE); } if((device = open("/dev/vid0", O_RDWR, 0)) == CERROR) error("open"); if(strncmp(argv[VALUE], "max", 3) == 0) value = BRIGHT_MAX; else if(strncmp(argv[VALUE], "min", 3) == 0) value = BRIGHT_MIN; else if(strncmp(argv[VALUE], "def", 3) == 0) value = BRIGHT_DEF; else value = atoi(argv[VALUE]); if(ioctl(device, DKIOCBRIGHT, &value) == CERROR) error("ioctl"); if(close(device) == CERROR) error("close"); exit(EXIT_SUCCESS); } -------