koreth@ssyx.ucsc.edu (Steven Grimm) (06/25/89)
Submitted-by: ucsd.edu!cacilj!close (Diane Barlow Close) Posting-number: Volume 2, Issue 44 Archive-name: djreset When you turn on your DeskJet Plus printer *after* your ST has been booted, the printer and the ST won't talk to each other and you can't print anything. The only way, until now, of solving this problem was to reboot the ST (leaving the printer on). When the printer has been turned on *before* the ST is booted, they will talk to each other just fine. As long as you don't turn off (and on again) your printer, you'll be just fine. I, for one, don't like to leave my printer on all the time. I like to be able to ``compute away'' and turn on the printer only when I actually need to print something. So far, with a DeskJet Plus, this has been impossible. My husband (Paul Close) and I wrote the following little desk accessory to ``reset'' the printer port and get the DeskJet and the ST talking again. (That's not exactly what it does, but it's close enough.) Much thanks to Moshe Braner for his desk accessory template. We've included the source code so that you can modify and ``pretty-up'' the DA to your liking. Currently it just blinks the screen when a reset is performed--we didn't add any desktop messages saying ``printer reset'' or anything like that. #!/bin/sh # shar: Shell Archiver (v1.22) # # Run the following text with /bin/sh to create: # DJ_RESET.C # sed 's/^X//' << 'SHAR_EOF' > DJ_RESET.C && X/* Reset your DeskJet Plus printer from the desktop. X Desk accessory written by Diane & Paul Close. X*/ X X#include <osbind.h> X#include <obdefs.h> X#include <gemdefs.h> X X#define TRUE 1 X#define FALSE 0 X Xextern int gl_apid; X Xint menu_id, event, ret; Xint xdesk, ydesk, hdesk, wdesk; Xint msgbuff[8]; Xint BUSY; Xint STATUS7; Xint STATUS14; X Xchar menusave[1520]; X Xmain() X{ X int i; X char *cp; X /* initialize printer reset options */ X int super(); X Cconws ("\033f"); /* disable vt52 cursor */ X appl_init(); X menu_id = menu_register (gl_apid," DJ Reset"); X wind_get (0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); Xdaloop: X event = evnt_multi (MU_MESAG, X 0,0,0,0,0,0,0,0,0,0,0,0,0, X msgbuff, X 0,0, &ret,&ret,&ret,&ret,&ret,&ret); X /* could have simply used evnt_mesag instead: X evnt_mesag (msgbuf); */ X if ((event & MU_MESAG) == 0 X || msgbuff[0] != AC_OPEN X || msgbuff[4] != menu_id ) X goto daloop; X graf_mouse(M_OFF,0x0L); X cp = (char *) Physbase(); X for (i=0; i<1520; i++) X menusave[i] = *cp++; X wind_update(TRUE); X form_dial (FMD_START, X xdesk, ydesk, wdesk, hdesk, X xdesk, ydesk, wdesk, hdesk); X /* enable vt52 cursor if needed */ X /* reset dj here (call subroutine) */ X Supexec(super); X X /* disable vt52 cursor if on */ X form_dial (FMD_FINISH, X xdesk, ydesk, wdesk, hdesk, X xdesk, ydesk, wdesk, hdesk); X wind_update (FALSE); X cp = (char *) Physbase(); X for (i=0; i<1520; i++) X *cp++ = menusave[i]; X graf_mouse(M_ON,0x0L); X goto daloop; X} X Xsuper() { X register unsigned char *busy; X busy=(char *)0xffffa01L; X BUSY=*busy; X busy=(char *)0xffff8800L; X *busy=7; X STATUS7=*busy; X *busy=14; X STATUS14=*busy; X STATUS14 |= 0x20; X *busy=14; X *(busy+2) = STATUS14; X} SHAR_EOF chmod 0600 DJ_RESET.C || echo "restore of DJ_RESET.C fails" exit 0