An X10 Controlled Backend for the CUPS Printing System
Introduction / Motivation
I have been searching for an inexpensive printing solution for a while. Inkjet print cartridges are horribly expensive, and most laser printers have a high initial cost. My solution was to get a HP Laserjet III with new toner from eBay. It ended up costing me about $40, after shipping. After winning the auction, I read on HP's website that the printer consumed 175 watts when idle. That's a lot of power! With that in mind, I wanted a way to have the printer be on only when needed, without having to remember to turn it off all the time. Using Linux, X10, and CUPS, I was able to acheive my goal.
Ingredients
- HP Laserjet III or other energy hog that has a physical power switch
- X10 CM11A Computer Interface, part of the ActiveHome package
- X10 3-prong Appliance Module
- Heyu, X10 software
- CUPS
Setup
I have a Mandrake Linux system, which comes with CUPS already installed. The following directory locations, and the scripts themselves, may have to be altered if your setup is different. Luckily the scripts are easy enough to understand that changing any paths or printer port will be easy. You will need to be root to do these steps.
- Make sure you can print
- Plug everything in. It should be fairly obvious how this works.
- Install Heyu according to the directions. If you plugged the CM11A into the first serial port, you shouldn't need to change the default configuration.
- Copy the X10 Backend script to the CUPS backend directory, /usr/lib/cups/backend. Make sure that it is executable by using 'chmod +x x10'
- copy the turn-off script into /usr/local/bin. Make sure it is executable by using 'chmod +x x10printeroff'
- Make the /var/state/x10 directory by using 'mkdir -p /var/state/x10'
- Edit /etc/cups/printers.conf to use the new backend. To do this, modify the DeviceURI line. Change the current value (mine was file:/dev/lp0), and add the value x10.
- Restart cups. On Mandrake, this is accomplished by 'service cups restart'.
Operation
When a print job is made, the printer will turn on and print. After a couple minutes, if another print job is not scheduled, the printer will turn off. You can modify how long to wait for more print jobs by editing the backend script.
Thanks to the people of the CUPS mailing list, who told me how to make the CUPS backend script.
Copyright 2002, Rick Funderburg
2006-07-11 UPDATE: A few months ago, I helped a fellow named Jim Woodworth understand a little bit about the CUPS backend system. He took what information I could provide and ran with it, creating a multiplexing printing system. It is pretty cool and demonstrates the power of CUPS.