[comp.sys.hp] Need screen blanker for HP9000/300

matt@puff.wisc.edu (Matt Schaefer) (10/28/87)

Here at the UW-Madison Comp Sci dept we are using several HP9000/300's
running HP-UX 5.3 with HPwindows. They have 98544a video boards driving 17"
monochrome monitors, which are already starting to show signs of burn-in. Has
anyone come across a screen-blanking utility? If so, posting or e-mail would be
appreciated. advTHANKSance
				      Matt Schaefer
				      UW Madison Computer Sytems Lab

ARPAnet: matt@puff.wisc.edu        USEnet: uwvax!puff!matt

daver@hpsgpa.UUCP (10/29/87)

>Here at the UW-Madison Comp Sci dept we are using several HP9000/300's
>running HP-UX 5.3 with HPwindows. They have 98544a video boards driving 17"
>monochrome monitors, which are already starting to show signs of burn-in. Has
>anyone come across a screen-blanking utility? If so, posting or e-mail would be
>appreciated. advTHANKSance

The 300 responds to standard HP terminal escape sequences, including the ones
which set the display color map.  My .profile contains a trap 0 which sets the
colors I use to black background and black characters, effectively blanking the
screen when I logoff.  The sequence \033&v0a0b0c0x0y0z0I sets color 0 to black
on black.

The form of the escape sequence is ESC&v to select the proper display
enhancement subset followed by various parameters expressed as 
<value><parameter letter> with the final parameter letter being uppercase.
The parameter letters are:

       a   foreground red           x   background red
       b   foreground green         y   background green
       c   foreground blue          z   background blue

each of which take 0 or 1 as values, specifying whether the corresponding color
gun is on or off, and I, which specifies which of the color map colors on the
screen is being affected.
    
A problem with the approach is that I have to logon the system blind, though
you can reset all the colors in the color map to their default values by
hitting CTRL-SHIFT-RESET.  My .profile automatically resets the color map to my
preferred colors when I logon (I use blue on cyan, with black on cyan for shell
command inputs selected as color 6 by my PS1):

                          echo '\033&v0m0a0b1c0x1y1zI'
                          echo '\033&v0m0a0b0c0x1y1z6I'
                          PS1="&v6S$D"  
Good luck.

dp@hpfcdq.HP.COM (David Pinedo) (10/29/87)

Here's my version of a screen saver.  It's advantages are that it's a lot
smaller than Mike Stroyan's. :-)  Like Mike's version, it too decides
that it is time to clear the screen when a certain amount has elapsed
since the keyboard and locator have been inactive.

There is one problem with any screen saver on HP Windows -- there is no
good way to detect that graphics output has occurred during some time
interval, short of reading all the pixels on the screen.  This is due
to the fact that graphics output does not involve having the window
manager run.  Even making changes to the window manager could not solve
this problem.

David Pinedo
Hewlett-Packard
Technical Workstation Operation
hpfcla!dp




/*********************************************************************
   screensaver program for HP Windows 

    Usage: screensaver minutes

        where minutes is the number of minutes of inactivity from the 
        keyboard or locator to wait before clearing the screen.

	After screensaver has cleared the screen, the original screen
	may be recovered by pressing any key or moving the locator.

    The best way to start the screensaver program is from a script to be
	invoked by wmstart:
	
	  screensaver 10
	  wsh -ka wconsole

    When starting window manager, use:

	  wmstart script

    Compile screensaver as follows:

	  cc -o screensaver screensaver.c -ldd<driver> -lwindow -lsb1 -lsb2

*********************************************************************/

	

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <signal.h>
#include <window.h>
#include <starbase.c.h>

int signalreceived = FALSE;


signal_handler()
{
    signalreceived = TRUE;
}


main(argc,argv)
int argc;
char *argv[];
{
    int wmfd;
    int gfd;
    int rval;
    long delay;
    char wmdriver[20];
    char wmkbd[40];
    char wmlocator[40];
    long timestart;
    time_t kbd_access_time, loc_access_time;
    struct stat statbuf;
    struct event_code winevent;
    
    extern long time();

    if (argc < 1 || sscanf(argv[1], "%d", &delay) < 0) {
	fprintf(stderr,"Usage: screensaver minutes\n");
	exit(1);
    }
    
    rval = fork();
    if (rval < 0) fprintf(stderr, "screensaver: fork failed\n");
    if (rval != 0) exit(0);
    
    wmfd=open("/dev/screen/wm", O_RDWR);
    winit(wmfd);
    wminquire(wmfd,"WMDRIVER",wmdriver);
    wminquire(wmfd,"WMKBD",wmkbd);
    wminquire(wmfd,"WMLOCATOR",wmlocator);
    
    /* Create a window */
    if (wcreate_graphics(wmfd,"/dev/screen/screensaver",0,0,1280,1024,1280,1024,
		     SETNORETAIN,SETNOBANNER) < 0)
    {
	fprintf(stderr,"screensaver: wcreate_graphics failed\n");
	exit(1);
    }
    
    /* Establish communication with the window */
    signal(SIGHUP, signal_handler);
    setpgrp();  /* We'll get a SIGHUP when the window is destroyed by wmstop */
    gfd=gopen("/dev/screen/screensaver", OUTDEV, wmdriver, 0);
    if (gfd < 0) {
	fprintf(stderr,"screensaver: gopen failed\n");
	exit(1);
    }
    winit(gfd);
    wautodestroy(gfd, 1);
    wrecover(gfd, 1);
    
    while (!signalreceived) {

    restart:
        
	/* Wait for inactivity for the specified amount of time */
        stat(wmkbd,&statbuf);
        kbd_access_time = statbuf.st_atime;
        stat(wmlocator,&statbuf);
        loc_access_time = statbuf.st_atime;
        timestart = time(0)/60;
        while (!signalreceived && time(0)/60 - timestart < delay) {
	    sleep(60);
	    stat(wmkbd,&statbuf);
	    if (kbd_access_time != statbuf.st_atime) goto restart;
	    kbd_access_time = statbuf.st_atime;
	    stat(wmlocator,&statbuf);
	    if (loc_access_time != statbuf.st_atime) goto restart;
        }
	if (signalreceived) break;
        
        /* Clear the window (and thus the screen) */
	wmove(gfd, 0,0);
	wsize(gfd, 1280,10240);
        wtop(gfd,1);
        clear_view_surface(gfd);
    
        /* Wait for a locator or keyboard event */
        wselect(gfd,1);
        wgskbd(gfd,2);
        winput_conf(gfd,K_TRACK, 1);     /* Request locator movements */
        wsetecho(gfd, 0);                /* Turn off locator echo */
        winput_read(gfd, &winevent, 1);
        wgskbd(gfd,0);
        wconceal(gfd,1);
        wselect(gfd,0);
    }

    wterminate(gfd);
    gclose(gfd);
    wterminate(wmfd);
    close(wmfd);
    exit(0);
}

daveh@hpubvwa (10/30/87)

It's very simple to clear the screen on the UNIX systems,
just create an /etc/issue file that does a home and clear
the screen.  This file is executed when the user logs off
the system.  I have appended our file to the respones.
HJ




hpubvwa

dp@hpfcdq.HP.COM (David Pinedo) (11/02/87)

A correction to my screensaver:  "make_picture_current(gfd);"
has to be added after the call to clear_view_surface.  I wrote and
tested the program using a pre-release version of HP Windows, which
seems to behave a little different.

David Pinedo
Hewlett-Packard
Technical Workstatation Operation
hpfcla!dp