Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: gbarker%mph.sm.ucl.ac.uk@nsfnet-relay.ac.uk (Gareth Barker) Newsgroups: comp.sys.sun Subject: Re: hp plotter Keywords: Hardware Message-ID: <29@brazos.Rice.edu> Date: 5 Jul 89 12:05:25 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 227 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 63, message 4 of 14 I think your problem may be with flow control - the first buffer gets sent properly and the HP then tries to use RTS/CST to tell the sun to wait a bit. The sun ignores this and then ... The way out is to tell the HP to use XON/XOFF flow control (and also apply YAPT 5.??? if your running SunOs 4.0.1). Below are our printcap entry and two simple filters that do what is required for our Roland plotter, which is supposed to be a HP clone - you may need to check the HP manual to make sure that all the escape codes are correct. (Thanks to Brian Utterback for the original filters based are based on). plt|plotter|dxy990:\ :sh:\ :lp=/dev/ttya:\ :sd=/var/spool/pltd:\ :lf=/var/adm/pltd-errs:\ :af=/var/adm/pltd-acct:\ :br#9600:\ :fc#0177777:\ :fs#0000001:\ :if=/local/filters/plotter_iffil:\ :xc#0177777: :xs#0000040: # ^^^^^^^^ make sure this is a #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'Makefile' <<'END_OF_FILE' XCFLAGS = -O XOBJS = plotter_offil plotter_iffil X Xinstall : $(OBJS) X strip $(OBJS) X mv $(OBJS) /local/filters END_OF_FILE if test 109 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi chmod +x 'Makefile' # end of 'Makefile' fi if test -f 'plotter_iffil.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'plotter_iffil.c'\" else echo shar: Extracting \"'plotter_iffil.c'\" \(1761 characters\) sed "s/^X//" >'plotter_iffil.c' <<'END_OF_FILE' X/* X iffil, a printcap filter for Roland DXY-990 plotter/ HP 7475 plotter X X Written by Brian Utterback X December 1987 X X Modified GJB 25/1/89 X*/ X X#include Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X int c,atoi(); X int contr,width,length; X int nlines=0,npages=2; X FILE *fopen(), *fp; X char *cp,*indent; X char *logi,*host,*actf; X X while (--argc) { X if (*(cp = *++argv) == '-' ) { X switch (cp[1]) { X case 'w': X width = atoi(&cp[2]); X break; X X case 'l': X length = atoi(&cp[2]); X break; X X case 'c': X contr++; X break; X X case 'i': X indent = &cp[2]; X break; X X case 'n': X logi = argv[1]; X break; X X case 'h': X host = argv[1]; X actf = argv[2]; X break; X } X } X }; X X X X printf("\033.M0;0;0;10;0;0:"); /* Reset the printer */ X printf("\033.I256;0;17:"); /* Set buffer size and XON char */ X printf("\033.N;19:"); /* Set XOFF char */ X printf("\033.@;0:"); /* Turn off DTR ??? */ X X X while ( (c = getchar()) != EOF) { X if ( c == '\n' || c == '\r' ) nlines++; X if ( c == '\f' || nlines > length) { X nlines = 0; X npages++; X }; X putchar(c); X }; X if (access(actf, 02) >= 0 && (fp = fopen(actf,"a")) != NULL ) { X fprintf(fp,"%7.2f\t%s:%s\n",(float)npages,host,logi); X fclose(fp); X } else { X fprintf(stderr, X "iffil: Can't open %s\n", actf); X exit(2); X }; X} END_OF_FILE if test 1761 -ne `wc -c <'plotter_iffil.c'`; then echo shar: \"'plotter_iffil.c'\" unpacked with wrong size! fi chmod +x 'plotter_iffil.c' # end of 'plotter_iffil.c' fi if test -f 'plotter_offil.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'plotter_offil.c'\" else echo shar: Extracting \"'plotter_offil.c'\" \(1285 characters\) sed "s/^X//" >'plotter_offil.c' <<'END_OF_FILE' X/* X offil, a printcap filter for printing the header page. X X Written by Brian Utterback X December 19878 X X*/ X X#include X#include X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X register char *cp; X register int ch; X X /* 'of' filters are only passed width and length arguments from lpd */ X while (--argc) { X if (*(cp = *++argv) == '-' ) { X switch (cp[1]) { X case 'w': X /* this filter does nothing with width */ X break; X X case 'l': X /* this filter does nothing with length */ X break; X X } X } X } X X X while ((ch=getchar()) != EOF) { X switch(ch) { X X case '\31': X /* X * LPD needs to use a different filter to X * print data so stop what we are doing X * and wait for lpd to restart us. X */ X if ((ch = getchar()) == '\01') { X (void) fflush(stdout); X (void) kill(getpid(), SIGSTOP); X X break; X } else { X (void) ungetc(ch,stdin); X ch='\31'; X } X default: X putchar(ch); X break; X } X } X exit(0); X} END_OF_FILE if test 1285 -ne `wc -c <'plotter_offil.c'`; then echo shar: \"'plotter_offil.c'\" unpacked with wrong size! fi chmod +x 'plotter_offil.c' # end of 'plotter_offil.c' fi echo shar: End of shell archive. exit 0 Hope this helps, Gareth J. Barker, Institute of Neurology, Queen Square, London, UK. JANET : gbarker@uk.ac.ucl.sm.mph INTERNET : gbarker@.mph.sm.ucl.ac.uk BITNET : gbarker%uk.ac.ucl.sm.mph@ukacrl.bitnet