A while back I decided that it was time for me to upgrade my printer. I had used my trusty HP DeskJet 870Cse for nearly five years, and it was time to upgrade. For various reasons to numerous to list here, I decided that my next printer was going to be a laser printer. Not only would it be a laser printer, but it would be a PostScript laser printer (why am I reminded of Dr. Evil demanding that the sharks have laser beams attached to their heads?).
By this time CUPS has pretty much won the 'Linux Printing System' wars, having been adopted by RedHat, Mandrake, as well as MacOS X. So there was no additional work to be done to actually install and configure CUPS. The real work was in choosing which printer to purchase. I began my selection process by consulting the trusty www.linuxprinting.org in order to help me choose a printer. It turns out that all Lexmark Optra laser printers have very recent Postscipt support (Poscscript Level 3, in fact), and the T520 had most of the stuff that I really wanted (including the ability to add a duplexing attachment). So the rest of this HOWTO assumes you alreday have CUPS installed. If you do not, check out www.cups.org) and grab the latest version.
As is the tradition of all printer manufacturers, the printer did not include either a USB or parallel cable that would allow me to connect it to my server. I quick run to Fry's turned up a nice 6' purple USB cable that would do the trick. So after positioning the printer on the desk, I went ahead and conncted it to an empty USB slot on my server and powered it up. I'm not sure if it's important to have printer powered up and connected when you confugre the USB drivers, but it seemed like a good idea at the time.
And now, there is the small matter of USB drivers.
As stated in the title of this HOWTO, I am using the stock RedHat 7.3 kernel (2.4.18-10 as of this writing). However, I have never actually attched any USB devices to my server before, so running the 'lsmod' command did not show any kernel modules with the letters 'usb' in them. Damn.
After several visits to linux-uxb.org I was able to piece together the lsit of modules that would have to be loaded in order for this to work. They are:
usbcore
usb-uhci
printer
Despite the name, the 'printer' kernel module is actually part of the USB module set. You can find the actual files in /lib/modules-2.4.18-10/kernel/drivers/usb/. To get these loaded, you need to run the following command as root:
> modprobe usbcore usb-uhci printerOnce you have run this command, you should see these modules in the 'lsmod' output...
> lsmod
Module Size Used by
usb-uhci 24420 0 (unused)
printer 8160 0
usbcore 71904 1 [usb-uhci printer]
Assuming you don't run into any error messages when loading those kernel modules, you're almost there. If the lsmod output does not contain the entries listed above, check the linux USB site for more troublshooting information. Now, it is time to 'mount' the USB Device Filesystem.
> sudo mount -t usbdevfs none /proc/bus/usb
This command will ensure that the operating system can communicate with the USB devices. If you want to make sure the USB Device Filesystem is mounted the next time you reboot your compter, you can add the following to your /etc/fstab file:
none /proc/bus/usb usbdevfs defaults 0 0
The next thing you need to verify is whether or not a parallel-port-like device entry is already present in the /dev/usb/ directory. So 'cd' into /dev/usb and check to see if there is an 'lp0' entry there. If you find no such entry, you can create it using the following command (executed from within the /dev/usb directory):
> mknod /dev/usb/lp0 c 180 0
As it turns out, this '/dev/usb/lp0' is the device name that we will use when telling CUPS how to talk to the printer.
So next I figured it was time to actually configure CUPS to recognize and use the printer. I knew that becuase the Lexmark T520 supported PostScript Level 3, that I would not need to use a manufacturer specific print driver, but I would need a PPD (PostScript Printer Description) file that would tell CUPS what options my printer came with. This is the file that CUPS uses when deciding what print options you see in the KDE 'Print...' dialog box.
So my next task was to go about locating this PPD file. I started with a trip to the Lexmark Drivers page and used 'T520' as the search term. Their driver locator then asked me if I had the T520 SBE (Small Business Edition printer), to which I answered 'No'. Next, the site asked me what operating system I was using. Most of the entries were for Windows, Mac, and DOS, so I choose 'Other'. Once I got to the third question, things started to look promising: 'Do you require PPD files?'...'Yes', I answered.
And that was apparently enough for Lexmark to decide what was right for me! After answering that yes, I did need PPD files, I was directed to a download page where I could download a file named LEXMARK-PPD.TAR.Z. Now we're getting somewhere!
I downloaded that file to my home directory, and used the following command to uncompress the archive:
> tar Zxf LEXMARK-PPD.TAR.Z
This led to the creation of a directory named 'lexmark-ppds'. Inside of this folder, I found what I was looking for: 'LEXT520.PPD'. But before you install this file, there is one modification you should make to it (using your favorite text editor). You should add the following line near the top of the file (where you see other lines like '*Product:'):
*Manufacturer: "Lexmark"This will make sure the T520 printer is listed among the "Lexmark" selections in the CUPS add new printer driver selection screens. I have no idea why Lexmark doesn't just include the "Manufacturer" line in the original PPD file. Once you have made this modification, you should copy the file to it's new destination and give it a new name:
> cp LEXT520.PPD /usr/share/cups/model/Lexmark_T520-Postscript-cups.ppdIf you like you can download a copy of my PPD file from here. As it turns out, the /usr/share/cups/model directory is where CUPS will look to find printer description files.
So now with the PPD file in place, and the printer all hooked up, it was time to actually tell CUPS about the printer. To do this, I used the KDE Printing Manager control panel (K Menu -> Control Center -> System -> Printing Manager'). Note, however that all of this can also be done using the CUPS web-based administration tools.
First, I entered 'Administrator Mode' by clicking the 'Administrator Mode' button of the lower-right corener of the KDE Printing Manager window. I logged into the Pringint Manager tool as user root. Once in Administrator Mode, I chose 'CUPS (Common Unix Print System)' from the 'Print System Currently Used' pull-dowm menu, also in the lower-right corner of the window.
Next, I clicked on the 'Add Printer/Class' icon (the left-most icon in the toolbar at the top of the window) in the Printing Manager window. I read the informational message, and clicked 'Next'. On 'Backend Selection' page, I choose the 'Local Printer (parallel, serial, USB)' radio button, and clicked 'Next'. I was then asked what port the printer was connected to, and I choose 'USB Printer #1' from the list of options and clicked 'Next'.
The 'Add Printer' wizard window then informed me it was building the printer driver database, which only took about 10 seconds. When it completed, I was presented with a list of printer manufacturers/models, a 'Postscript Printer' checkbox, and a 'Other...' button. I selected "LEXMARK" from the list of manufacturers. In the right-hand select list, I then found and selected 'T520 PS' as the printer model/driver. I then clicked 'Next >>'.
On the following window, I pressed the 'Test' button to print a test page...and it WORKED! I then pressed the 'Next' button one last time, and the configuration was complete. The Lextmark T520 was now listed in the KDE Printing Manager printer list. I right-clicked on that icon and choose to set the Lextmark T520 as my default printer.
And that's it. You're done. Print a test page and go to bed. The world is good now.