VP(4) — System Manager’s Manual — Special Files
NAME
vp − Ikon 10071-5 Multibus Versatec parallel printer interface
DESCRIPTION
The Versatec printer/plotter is normally used with the programs vpr(1), vprint(1) or vtroff(1). This description is designed for those who wish to drive the Versatec directly.
The Ikon parallel interface board consumes 32 bytes of Multibus I/O space starting at standard base addresses of 0x400 and 0x420. The Ikon board must be set for interrupt level 1 and must be configured for byte-wide bus transfers.
To use the Versatec yourself, you must realize that you cannot open the device, /dev/vp0 if there is a daemon active. You can see if there is a daemon active by doing a ps(1), or by looking in the directory /usr/spool/vpd. If there is a file lock there, then there is probably a daemon /usr/lib/vpd running. If not, you should remove the lock.
In any case, when your program tries to open the device /dev/vp0 you may get one of two errors. The first of these ENXIO indicates that the Versatec is already in use. Your program can then sleep(2) and try again in a while, or give up. The second is EIO and indicates that the Versatec is offline.
To set the Versatec into plot mode you should include <vcmd.h> and use the ioctl(2) call
ioctl(fileno(vp), VSETSTATE, plotmd);
where plotmd is defined to be
int plotmd[] = { VPLOT, 0, 0 };
and vp is the result of a call to fopen on stdio. When you finish using the Versatec in plot mode you should eject paper by sending it a EOT after putting it back into print mode, that is, by
int prtmd[] = { VPRINT, 0, 0 };
...
fflush(vp);
ioctl(fileno(vp), VSETSTATE, prtmd);
write(fileno(vp), "\04", 1);
N.B.: If you use the standard I/O library with the Versatec you must do
setbuf(vp, vpbuf);
where vpbuf is declared
char vpbuf[BUFSIZ];
otherwise the standard I/O library, thinking that the Versatec is a terminal (since it is a character special file) will not adequately buffer the data you are sending to the Versatec. This makes it run extremely slowly and tends to grind the system to a halt.
FILES
/dev/vp0
SEE ALSO
vfont(5), vpr(1), vtroff(1), va(4)
Sun System Release 0.3 — 2 May 1983