Updated August, 2000 Program: pup v1.1 Author: Matt Simpson Arlington, TX matthewsimpson@home.com Websites: http://pup.sourceforge.net (main site) http://pup.virtualave.net http://pup.hypermart.net Date: August, 2000 Initial Release: v1.0 August, 1999 Special Notes: The env variable PUPDEV (for default output) is no longer used; instead the default is now set in Pup's preferences window, which will write the file $HOME/.puprc Documentation: In this file after the legal notices. ***************************************************************************** ***************************************************************************** COPYRIGHT (C) 1999, 2000 Matt Simpson ---------- GPL NOTICE ---------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************** Credits: ***************************************************************************** Lexmark and Optra are trademarks of Lexmark International, Inc. Printer specific calls courtesy of Lexmark International, Inc. with permission from (and thanks to) David Lane of Lexmark. All Lexmark specific printer command strings in Pup have been released for public distribution. All PJL commands were extracted from applicable printers, with the Lexmark Printer Technical Reference manual used as a guide. This includes PJL commands used on the HP printers. HP provided no help or support whatsoever and refused my email queries, so I can not give HP credit for anything other than the fact that they originally wrote PJL. ***************************************************************************** Contributors: David Lane dlane@lexmark.com Lexmark ink cartridge commands and Tech Ref Manual for PJL commands. Grant Taylor gtaylor@picante.com (Linux Printing HOWTO maintainer) Snippet for supporting network printers through lpr. Brian Hall brianw.hall@compaq.com Some PostScript code for the Pup Printer Test Page. David Walser luigiwalser@yahoo.com Some info on the Optra E310. Richard Simpson rs@rcsimpson.demon.co.uk Tested Pup on Linux Alpha. Charles Sandel sandel@texas.net Tested Pup on Solaris x86. Many Thanks!! ***************************************************************************** Other Copyright Notices: ***************************************************************************** Pup uses a True Type Font (TTF) for printing a TTF test page. This font was converted to PostScript and put into a test PostScript program using gfontview. The only requirement by the author of this font is to include the following message, and not to change the font, which I did not. The author's message, which I have repeated in the comments of the PostScript program, is as follows: sadantype presents . . . PENNY BOLD Typeface copyright (C) 1998 Meir Sadan <meir@sadan.com> This font is distributed via http://www.sadan.com Please do not redistribute this font without this accompanying text file. This font is FreeWare, which means you can use it freely as long as you don't change it in any ways without prior permission from the maker. ***************************************************************************** Pup uses some source code taken from the uuencode and uudecode utilities. The following notice is required by the copyright owners of these utilities: uuencode/uudecode utility. Copyright (C) 1994, 1995 Free Software Foundation, Inc. <** See GPL NOTICE above **> Copyright (c) 1983 Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by the University of California, Berkeley and its contributors. 4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************** All libraries used by Pup, including those not mentioned above, are copyrighted by their respective owners. See those libraries' documentation for licensing information. ***************************************************************************** ***************************************************************************** Description ----------- Pup stands for "Printer Utility Program". It is a Graphical User Interface for managing printer settings for Linux or any Unix O/S that supports GTK+, zlib, and GNU C. Pup specifically supports the following printers: Lexmark Optra Color 40 and 45 Xerox Docuprint C20 (same as the Lexmark Optra Color 45) Lexmark Optra E310 HP 2100M HP 4000 HP LJ4 Plus Additionally Pup has a dynamic mode that may support any PJL printer, not just those listed above. It does this by querying the printer to see what PJL (Printer Job Language) commands are available (as a prerequisite, the printer must support PJL). For this to be available, your system must be configured for printer read-back (see below). Since I have not tested all PJL printers, I would be interested in hearing success stories. Pup's current features include ink cartridge setup and maintainance (Lexmark Optra 40/45 only), printing of various test pages, printer status, and changing printer default settings. There are two ways to change the settings: the "dynamic choices" and the "fixed choices" methods. The dynamic choices method queries the printer, filters out some things, and builds a list of choices for you to change settings. Current settings are high-lighted in red. There is also the feature to query the printer to see all settings unfiltered, for information only. The fixed choices method is for the specific printers listed above, and are based on queries I did before hand on these printers and hard-coded into Pup. This is for those folks who do not have read-back available on their system, as it works in uni-directional mode. However, the choices offered are not as many as may be offered in the dynamic mode, because I elliminated those choices that do not show up on the printer's printed configuration page. This way any changes you make can be verified by printing a configuration page. The printer can be selected in Pup's Preferences window (under File). You can save your selection in this window to make it your default every time you run Pup. Pup sends the appropriate commands to whatever is listed in the output box-- either a printer device, a file, or an lpr command (when preceeded with a '|'). If a file is used, this file can then be ftp'd to a remote printer or you can cat it to the device directly (e.g. /dev/lp0). In dynamic mode Pup requires a device. The help window describes all the features of pup. To view it, bring up Pup, go to the Help menu and select 'Info'. Check out my hand scroller by putting the mouse inside the window and pressing the first mouse button. There are also help buttons on the Set Printer Defaults windows. Pup does a lot of error checking and presents the applicable messages at the bottom of the window in use. Many times it also presents an "Explain" button for more info. This is my idea of presenting information to resolve a problem at the exact time you need it, instead of giving a useless message or the program locking up or crashing as is the case with many commercial programs I have used in the past on a different operating system. I say this about Pup on Linux, and note that I have had problems on SunOS when not configured for bi-dir mode; in this case the error testing passes and Pup goes slow and then locks up. (For uni-dir mode it works fine.) Pup stores some things in arrays as zlib compressed and base64 encoded, and undecodes/uncompresses them as needed. These include the images on the Pup test page and the PostScript TTF page, which are decoded/uncompressed a chunk at a time during output. I did this as an exercise for writing code that saves memory. There is a standalone program included with Pup as a source file, called mydeflate.c. This can be compiled to make a program that compresses and encodes anything for inclusion into an array that the Pup routines can decode/uncompress when needed. Consult the header of this file for more information. Since pup uses GTK+ you must have libgtk, gdk-imlib1, and libglib to run it. You also need zlib. To compile it you need the related header files. If you downloaded the binary version and you get errors when trying to run it and you do have the libraries installed, this likely means the libraries I compiled the binary with are more up to date than yours. You should update your libraries. If all else fails, get the source code and compile/link it yourself. To compile/link pup yourself, just type make in the directory you gunzipped and untarred to. The result is the file pup. Move the pup binary to /usr/local/bin or other directory in your path and type rehash to update your path. Add it to your desktop menus if you desire. You may use the pup logo without restrictions as I built it with The Gimp. It is located in the source file logo.h as an xpm. Just edit the file to remove the text at the beginning up to the /* XPM */, as well as the #endif at the end and write it as a different name with a .xpm extension. Then read it with The Gimp to resize it to an icon size. To be able to use Pup as not root, either change permissions to the output device (e.g. /dev/lp0) or add your user to the group that belongs to this device and make sure it has group rw permission. For more complete installation instructions, read the web page. For more complete info, read the help windows and/or the source code. Email me if you have comments or questions. ------------------------------------------------------------------------ Printer Notes ------------- HP LJ 4 Plus The PostScript commands (printer status, print Pup test page, print TTF test page) only works when you have the PostScript plug-in module attached to the printer. Even so, the Print PS fonts command will not work because the printer does not provide a PJL command for this; however, you should be able to print the PS fonts from the control panel on the printer. Operating System Notes ---------------------- If you get read-back support on an OS that Pup does not support with this release, please email me with the procedure or required additions/changes. Also if anything needs to be changed to compile cleanly, please email me. Linux x86 You can get read-back support by selecting CONFIG_PRINTER_READBACK=y in your .config file of your kernel source directory and compiling the kernel. If you do a make xconfig for generating your .config file, the read-back option is under Character Devices -- Support IEEE1284 status read-back. Linux Alpha I have corresponded with Richard Simpson (rs@rcsimpson.demon.co.uk) who has an Alpha with Linux and he was able to compile Pup cleanly and have no problems with printer read-back. It appears Pup works on Linux Alpha exactly like it works on Linux x86. It seems Pup is ready for 64-bit! IRIX Although Pup compiles cleanly with both gcc and cc, I have not been able to get bi-directional parallel port support. (But Pup works in uni-directional mode.) The man page (man plp) says bi-dir is supported only on certain systems like the Indy. However, you have to do some ioctl calls which I tried unsuccessfully. If you figure it out, please email me. Note if you get bi-dir working the output device will be /dev/plpbi SunOS 5.6 (Sparc) Pup works in uni-directional mode but not so well in bi-dir mode. All of Pup's error checking passes, yet the reading of the parallel port causes Pup to go slow and then lock up. Doing a cat on /dev/ecpp0 after the query yields some of the printer's returned variables but this freezes up without finishing. If you do a man bpp there is some information on bi-dir; however, I have not taken the time to figure out what it is trying to tell me. Something to do with ioctl commands. If you figure this out, please email me. Solaris on x86 I do not have access to this platform but I was emailed by someone who does and he mentioned similar results listed above under SunOS 5.6. If you figure out how to get bi-dir working on this platform, please email me. ------------------------------------------------------------------------ The following discussion does not include ink cartridge maintainance, as only the Lexmark Optra 40/45 is supported for this. How to add support for an additional printer for the non-dynamic (fixed) features (e.g. everything but Query printer settings, Set Printer Defaults -- Dynamic choices, Printer Status, Print Pup test page, and Print TTF page): 1. Add PJL variables to *pv[] in the file fixed.h, in the same format as the others listed there. Note there is a comma between each set. Quotation marks can be at the beginning and end of each set, or at the beginning and end of each line within each set, with a \n before each line's end quote. (The former is supported by gcc and the latter is supported by gcc and the IRIX compiler cc.) The easiest way to get variables into this format is to have querying available (e.g. have your kernel configured for read-back) and use the 'Query printer settings' window to query the printer, then put the mouse in text select mode (click the big T), then select everything after the @PJL INFO VARIABLES with the mouse and paste this into a text file for copying to *pv[]. Note your mouse copy buffer is limited in size so you should copy about half the text, paste it, and then copy the other half, otherwise you might have problems pasting it. When you copy the variables to *pv[] you should elliminate things you don't want to be able to set. An example is if you print out the printer's settings, it does not list all things that come back when you do a query; since you are adding support for output commands only and cannot verify your changed settings other than looking at a fresh printout of the settings, you should only offer what can be verified. (We will let the dynamic settings window handle the the extra variables, as they can be verified simply by doing another query.) You may ask, if I need to have kernel read-back support to do a query so I can get the variables needed for using Pup without kernel read-back support, why bother continuing? After all, if you go through the process of getting kernel read-back support, you don't need the fixed choices window anymore. Well, maybe you want to use Pup on a machine without kernel read-back support and you have access to a machine that does, and you can temporarily hook up the printer to query it. 2. Add the printer model into *printer_name[] in the file fixed.h, in the same order the corresponding variables were added in *pv[]. Keep the "end" string at the end! 3. Assign the "family of commands" to the new printer in set_printer_family() by adding a case statement. You may assign an existing family or create a new one (depends on what the new printer understands). See example there and at the end of fixed.h. You may also create a new command by adding a new array in fixed.h and adding a case statement in get_family_command(). See examples in these places. Then you need to add a button somewhere in Pup to access this new command. 4. Inhibit pages or buttons/labels for the new printer in set_inhibit(). 5. Do a make, run Pup, and select File--Preferences. Select your new printer model and save the preferences. Test, then email me your changes for inclusion into the master copy :-) How to remove a variable from being offered in the dynamic choices window: 1. Add the variable name to *skip[] in the build_choices.c, and increment skipnum. This will remove it from the dynamic choices window (so you can't change it) but still list it in the Query settings window. 2. Do a make, run Pup, and test. Matt Simpson matthewsimpson@home.com Please tell me what you think about Pup!