Path: utzoo!utgpu!watmath!uunet!nwnexus!cjsa!jeff From: jeff@cjsa.WA.COM (Jeffery Small) Newsgroups: unix-pc.general Subject: Re: UNIX-PX Printer Setup Summary: Here's what I do to print graphics ... Keywords: UNIX-PC Printer 7300 3B1 graphics screen-print Message-ID: <175@cjsa.WA.COM> Date: 13 Mar 89 20:07:09 GMT References: <932@mtfmi.att.com> <719@kosman.UUCP> Organization: C. Jeffery Small and Associates - Woodinville, WA Lines: 225 In article <719@kosman.UUCP>, kevin@kosman.UUCP (Kevin O'Gorman) writes: > In article <932@mtfmi.att.com> tjc@mtfmi.att.com (T.CZARNECKI) writes: [ .. lots of printer problems being discussed ...] OK. I have spent many-many hours trying to solve the print spooler mysteries of the UNIX-PC. Here is a summary of what I have learned. There will be a lot of "obvious" things discussed here for many of you - but I have made an effort to be reasonable complete. First of all, if you want to get control over the spooler, you simply have to do the work from UNIX. The User Agent lets you do simple tasks but really limits you when you try to perform the unconventional. Get those manuals out and look this stuff up. The commands you will need to use are: enable(1), lpstat(1), accept(1M), lpsched(1M), lpadmin(1M) Lesson number 1 is that when you try to do any lp setup work with these commands (especially lpadmin), if the command fails: *** YOU DON'T GET ANY ERROR MESSAGES, WARNINGS OR FEEDBACK ***** The lp system is generally silent and just returns - whether or not it has performed your requested task. This makes it extremely difficult to know what is going on and is probably the single biggest reason that people find that they cannot get printers properly configured. You have to become user id "lp" in order to (successfully) issue many of the lp commands. Not even "root" can do these tasks! So (as root) set an appropriate password for lp and then "su lp". Now you've got a fighting chance! Also note that many of the administrative commands reside in /usr/lib - so add this to your PATH to make life a lot easier. As any login id, you can find out how your system is currently configured by typing: "lpstat -t". Here is sample output from my system with my added running commentary noted by all lines starting with a "##": scheduler is running ## As user "lp" you can start the scheduler with "lpsched" and shut it down ## with "lpshut". To do most routine administrative tasks you HAVE to ## "lpshut" the scheduler. If you don't, your subsequent commands are going ## to silently fail - whether you are user "lp" or not! I don't want to ## think about how many time this has bitten me. I don't want you to think ## about it either :-) system default destination: Epson ## You set the default system printer with the command: lpadmin -dPRINTER_NAME ## Now, just because getopt is a good idea, don't think that anyone at AT&T is ## using it. That's right - no space allowed between "-d" & the printer name! ## This applies to the other options as well. members of class Serial: Daisy Diablo630 members of class Parallel: Quantex Epson ## Here we see that I have four printers hooked up to my system - 2 Serial ## and 2 Parallel. Now you want to know where to order that Parallel port ## expansion board don't you! The fact is, there are only two printers on ## this system - 1 Serial and 1 Parallel. I have just given each printer ## two names. Realizing that you can do this, is a big step in getting ## the system to work the way you want it to. I have a Quantex #7065 dot ## matrix printer which has a bunch of snazzy capabilities when it operates ## in native (ie. Quantex) mode. So I have created a "Quantex" printer with ## a customized interface (discussed below) which gives me access to all of ## these features. Unfortunately, the UNIX-PC can't be made (at least by me) ## to understand the Quantex's graphic print mode. Fortunately, the printer ## will accept an escape code sequence which will put it into Epson mode. I ## have created an "Epson" printer with its own interface which simply puts ## the Quantex into Epson mode and then passes whatever onto the printer. This ## is how you get screen prints to work! I'll bet there are a lot of printers ## out there that will do Epson-graphics if you could just get your UNIX-PC to ## talk to them properly! ## ## BTW: I believe that on pre-3.5 versions of the OS, the graphics printer had ## to be the first - ie. the Default printer on the system. On 3.5/3.51, I ## think you will find that for screen prints, the Default printer is first ## checked to see if it supports (as far as 3.51 OS is concerned) graphics. ## If it does, the screen dump will go there. If that printer is not recognized ## as a graphics printer, then other printers you have specified will be ## examined until a "graphics" printer is found. If one is located, then the ## screen dump will be queue there. Thus, If I specify that the "Diablo630" ## is the Default printer on my system, a screen print request will still find ## its way to the "Epson" 'cause that's the only "graphic" printer that has ## been configured. ## ## Also BTW: If you are running the Smart software, then you will HAVE to set ## the Default printer to the appropriate one which you have configured within ## Smart because Smart only supports ONE printer and it HAS to be the Default. device for Quantex: /dev/rawlp device for Daisy: /dev/tty003 device for Epson: /dev/rawlp device for Diablo630: /dev/tty003 ## Here you can see that the pairs of names point to the same device location. ## There has been a lot of discussion about how /dev/lp massages you output ## and, in the process, messes up things like page-break and the margin ## settings. They did (finally) add the setprint(1) command to the system, but ## long ago I decided that it is easier and more sensible to attach the printer ## to the raw parallel device and manage the format of the output either from ## the interface program (discussed below) or directly at the printer by the ## various option (switch) settings that most modern printers offer. For ## example, my printers handle page breaks far more intelligently than any ## driver or interface script could - so I let them do that job. This works ## especially well when you have long lines. Regardless of whether I set my ## printers for "truncate" or "wrap-around", they will keep track of the actual ## physical number of lines printed (rather than the # of logical lines) and ## will handle page breaks properly. The dumb interface programs were always ## getting this wrong and I use to get those horrid pages with just one line ## of text at the top. Quantex accepting requests since Sep 2 18:25 Parallel accepting requests since Sep 2 18:25 Epson accepting requests since Sep 24 15:27 Daisy accepting requests since Feb 10 14:30 Serial accepting requests since Feb 10 14:30 Diablo630 accepting requests since Feb 10 14:30 ## Once you add or change a printer with lpadmin, you have to tell the system ## that it is ready to accept requests. You do this with the "accept(1M)" ## command. You use "reject" to deactivate this. See the man page. printer Quantex is idle. enabled since Sep 6 15:48 printer Epson is idle. enabled since Sep 15 08:08 printer Daisy is idle. enabled since Feb 10 14:30 printer Diablo630 is idle. enabled since Feb 10 14:30 ## You also have to "enable(1)" each printer before you can print on it. ## Any time there is a serious problem with the printer (cable is disconnected, ## paper-out signal, etc) the system "disable"s printing. Once the problem ## is fixed, the printer needs to be manually re-"enable"d. ## Don't forget to "lpsched" the system when you are done. Now for a set of sample commands to create the above configuration: % su lp Password: lp% lpshut lp% lpadmin -pQuantex -cParallel -h -mdumb -v/dev/rawlp lp% lpadmin -pEpson -cParallel -h -mdumb -v/dev/rawlp lp% lpadmin -pDaisy -cSerial -h -mdumb_S -v/dev/tty003 lp% lpadmin -pDiablo630 -cSerial -h -mdumb_S -v/dev/tty003 lp% accept Quantex Epson Daisy Diablo630 Serial Parallel [you should get status messages here] lp% enable Quantex Epson Daisy Diablo630 [you should get status messages here] lp% lpsched [you should get status message here] lp% exit % And finally, you now need to customize the dumb interface scripts which were put into the /usr/spool/lp/interface directory (-m option to lpadmin) and named after your printers. The beauty of the System-V spooler system is that you have full control over the system because you can make these interface programs be anything you want them to be. Go ahead, process special options, issue control codes, change the tty settings, anything you want! Here is the one I use for "Epson" to put my Quantex printer into Epson graphics mode. If you compare this to what you get with the default "dumb" script, you will see that I ripped out all of the header junk which prints that unwanted banner page with every job. ----------------------------------------------------------------------------- # lp interface modified for use as interface to Epson MX-80 mode of Quantex # copies=$4 options=$5 raw=$6 shift; shift; shift; shift; shift if [ "$1" = "-raw" ] then shift fi files="$*" i=1 echo "\033[1!d\c" # put Quantex into Epson mode sleep 3 # give it some time to "take" echo "\033@\c" # issue a reset to initialize Epson mode sleep 3 # also some time for it to "take" while [ $i -le $copies ] do for file in $files do cat "$file" 2>&1 # dump the stuff to the printer echo "\014\c" # I DO want a page-break between each graphic # print job - so this stays (this time) done i=`expr $i + 1` done echo "\033q\c" # issue reset to put us back into Quantex mode sleep 5 # wait for this to "take" exit 0 ----------------------------------------------------------------------------- Well, those are the basics. I hope you had fun and found some of this useful. If there is any interest, I can also provide some info on: * sharing printers between UNIX-PCs connected by serial cables (the dumb-remote scripts don't do the job if you try to pass printer options) * I can post a sample "C" interface program I wrote which allows me to set all the neat options of my Quantex and Daisy printers (speeds, margins, page lengths, fonts, graphic modes, proportional spacing, etc) and a shell script which I use to print all of my jobs that acts as a nice front end to the interface program. These won't be of any direct use to anyone, but they could serve as a model which could be modified to meet your particular printing needs. Let me know! -- Jeffery Small (206) 485-5596 uw-beaver!uw-nsr!uw-warp C. Jeffery Small and Associates !cjsa!jeff 19112 152nd Ave NE - Woodinville, WA 98072 uunet!nwnexus