Re-use an old printer

From www.chip-community.org
Jump to: navigation, search

Re-use an old parallel printer (or new USB one) with C.H.I.P, CUPS, and an adapter cable

I've had a trusty workhorse printer hooked up to an AMD Athlon64 box for some time. The printer is from before the days of USB. It only has a Centronixs interface. The set up worked fine until the computer went caput. So, lacking another computer with parallel capability, I've been without a printer for a few weeks.

It's not such a bad thing. The computer was an energy hog. Still, I wondered what my best options were to get back to printing. A new (probably used) computer with parallel interface? A new printer with USB interface? I wasn't really excited about looking at what was available. And, then my C.H.I.P. arrived.

Could I replace my printer server with C.H.I.P? I searched for USB to Centronixs adapters, not even sure if such a thing existed, and sure enough, there were tons. So, here is a fairly simple explanation of how to turn C.H.I.P. into a skookum little printer server for use with a parallel printer. The hardware part is easy. Most of the work involves configuring CUPS (Common Unix Printing System).

Note that, the hardware part being so simple, all that is needed to adapt this to a USB printer is to swap in the appropriate USB-to-USB cable.


What You'll Need

Materials

  • 1 x C.H.I.P. flashed with a headless OS
  • 1 x USB to parallel (Centronix) cable
  • 1 x printer with parallel port

You could do this with a GUI version of ChipOS flashed to C.H.I.P. but that's not the route I chose.

Be careful when buying the USB to parallel cable. There are two kinds. One kind has a DB-25 connector on the end, the other a DB-36 (Centronix) connector. You want the DB-36 Centronix connector to pair with the printer.

Software

  • CUPS (Common Unix Printing System)
  • elinks (a text-based web-browser)

Unless you're using a GUI version of ChipOS, a text-based browser is needed for initial setup off CUPS on C.H.I.P. elinks is the text-based browser that I use. During the initial setup, you can choose to allow remote administration. After that, if you prefer, you can access CUPS on C.H.I.P. with a regular browser from your desktop.


Is the Printer Supported?

In addition to this hardware and software, you'll need to make sure that your printer model is supported by CUPS. Tons are supported, but not all. Go to https://www.openprinting.org/printers. If you know your model number, you can look it up directly by choosing manufacturer and model from the menus. Alternately, you can enter just the manufacturer and browse all by that manufacturer, known by CUPS. If your printer is supported, your good to go.

Preparing C.H.I.P.

The first thing to do is make sure that the chip user's password is not too long. CUPS allows a maximum password length of 39 characters. If your user's password is longer than this you need to shorten it before you continue.

The next thing is to ensure that the package cache and installed software are up to date:

   $ sudo apt-get update
   $ sudo apt-get upgrade

Once that is finished, it's time to install CUPS and elinks:

   $ sudo apt-get install cups elinks

Plug your cable into the printer and into C.H.I.P's USB port. Turn on your printer.


An elinks Primer

Since we'll be using elinks in this setup, a brief primer in how to use it might be useful to some. elinks will accept mouse input. However, if you are connected via UART, you won't have that option.

In that case, use the down- and up-arrow keys to move between the links and input fields. Use the right-arrow key to follow a link, or to open up a drop-down menu, depending on where your cursor is. The left-arrow key navigates back to the previous page in the browser history.

If you are on a radio button or check box, and want to select it, press enter. If you are over a text field and want to enter text, first press enter. When you are done entering text, press the up- or down-arrow key to change fields. When you're done with elinks, type "q" to quit.


Configuring CUPS

Now is time to configure the printer server. CUPS listens for connections on port 631. To access CUPS' HTML interface, enter the following command on C.H.I.P.:

   $ elinks https://localhost:631

Remote Administration

The first thing we are going to configure is remote administration. This isn't essential to configuring a printer, but it will allow you to work with CUPS from a graphical browser on a remote computer. If you prefer, you can skip enabling remote administration access, but it means working with a text-based browser locally on C.H.I.P.

In elinks select "Administration" from along the top of the window. In the Administration window, choose "Advanced" and follow the link. Move down to "Allow remote administration" and select it.

This is all we need for remote admin, but while we are here, we're going to check off "Share printers connected to this system". This means that printers connected to C.H.I.P. can be printed to from anywhere on the LAN. Now, move the cursor down to "Change Settings" and hit the right-arrow key. It will take a few seconds for the new configuration to get set up. Wait until you see the Administration page again.

Connecting From Your Desktop

Now you can go to your desktop, and continue from there. Unless you have DNS set up for your local network, you will need to copy down the IP address of C.H.I.P. Let's say that it's 192.168.1.10. In a browser on the remote computer enter the URL https://192.168.1.10:631. You may get a certificate error. You can safely ignore that if you are sure you're connected to C.H.I.P.

Add a Printer

We want to return to the "Administration" link, except that this time we're going to select "Add Printer". You will be prompted to enter a user name and password. Enter your administrative user ("chip" unless you changed it), and password. This is where too long a password won't work. You may need to wait 5 or 10 seconds for the authorisation to take place.

On the next page, choose "Serial Port #1". I'm pretty sure it will be #1 for everyone, but I'm not certain. Try it and see. If you are still working from within elinks on C.H.I.P, this is where you need to hit enter to select the radio button. Select the "Continue" link.

In the next screen (connection, baud rate, parity, etc), I didn't change anything. I simply selected "Continue".

Next, you'll be asked to choose a name for this printer. To enter text in these fields using elinks, you need to move the cursor over the field, and then hit enter. I'd suggest choosing something significant you can remember, but keep it short.

The description and location fields allow you to add additional information about the printer. Select "Share this printer". Once you're satisfied with this screen, select "Continue". Once again, you have to wait a few seconds for the right page to refresh.

The following screen is where you tell CUPS what kind of printer is attached to it. Select the brand and then hit "Continue" and wait a few seconds. Choose your model from the list, then select "Add Printer".

Another screen appears in which you can give the particulars of your printer's configuration. The only thing I had to change on this page was the "Media Size". It defaulted to A4. I'm in North America, so I selected letter size. If you modify anything on this page, don't forget to select "Set Default Options".

Does It Work?

The next thing you see is the printer's administration page. Now comes the moment of truth. On this page there is a menu labelled "Maintenance". One of the options in this menu is "Print Test Page". Give it a whirl.

And You're Done

If that worked, congratulations, you're done! You should now see the printer you just configured from other computers on the network. Happy printing!