There are a plenty of tutorials on web on this topic, yet none of them worked for me out of the box, so I put together this guide with steps that worked for me (mostly based on this and this tutorial).
The printer was a HP Laserjet 2300L equipped with USB connection only. Upon connecting the printer to the storage I encountered the first issue:
~#: lsusb
had no output at all. However
~#: cat /sys/bus/usb/devices/1-1/product
hp Laserjet 2300L
revealed that the printer is indeed there so that there is no hardware problem.
What we need first of all is the following:
~#: mount -t usbfs none /proc/bus/usb
so that lsusb will be able to list devices.CUPS is ready to roll now:
~#: ipkg install cups cups-doc cups-driver-gutenprint cups-pdf hpijs
will install CUPS version 1.4.2 and HP printer device drivers.
Contrary to earlier versions in the package repository, this one works well so no recompile is necessary (so the presence of gcc is not required). The web interface of CUPS will be available at http://IP_of_NAS:631. Since for /admin https is required (and is a good practice anyhow), we still need to create the proper ssl certificate since this automatism fails for some reason:
will install CUPS version 1.4.2 and HP printer device drivers.
Contrary to earlier versions in the package repository, this one works well so no recompile is necessary (so the presence of gcc is not required). The web interface of CUPS will be available at http://IP_of_NAS:631. Since for /admin https is required (and is a good practice anyhow), we still need to create the proper ssl certificate since this automatism fails for some reason:
~#: openssl req -new -x509 -keyout /opt/etc/cups/ssl/server.key -out
/opt/etc/cups/ssl/server.crt -days 365 -nodes -config /opt/share/openssl/openssl.cnf
/opt/etc/cups/ssl/server.crt -days 365 -nodes -config /opt/share/openssl/openssl.cnf
and then:
~#: cupsd
starts the daemon itself. We still lack the USB printing support which should be available as a kernel modul. This I found here (great thanks for Bertram Winter!). This should be put to the following directory:
/lib/modules/2.6.24.4/kernel/drivers/usb/class/. This can be easily achieved by issuing:
~#: mkdir /lib/modules/2.6.24.4/kernel/drivers/usb/class/
~#: wget http://members.aon.at/berwinter/mbwe/usblp.ko.whitelight -O /lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko
Don't forget to create the corresponding node!
~#: mknod /dev/lp0 c 180 0
So the modul is ready to be loaded:
~#: insmod /lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko
It worth a note that even though /dev/usb/lp0 exists, still /dev/lp0 has to be used.
So now we have three USB related moduls:
~#: lsmod | grep usb
usblp 12064 0
usb_storage 35936 0
usbcore 120212 4 usblp,ehci_hcd,usb_storage
We can also test whether CUPS also sees what needs to be seen:
#:/opt/lib/cups/backend/usb
DEBUG: list_devices
DEBUG: usb_find_busses=1
DEBUG: usb_find_devices=2
Now we can add the printer on the web interface: https://IP_of_NAS:631/admin
Login/pass are the root credentials. The printer should be visible after choosing "Find New Printer". The rest is quite self-explaining, I chose the corresponding HP Laserjet 2300 PS driver. Note: the "Share Printer" checkbox should be checked! Most of the default options are OK, only paper size has to be changed to A4 (at least in Europe ;)). Some fine tuning includes reduce of maximum amount of jobs and clients as this one is anyhow an embedded system. For this, refer to the following screenshot:
Now the printer should be visible if pressing "Manage Printers":
For the clients the printer will be available as: https://IP_of_NAS/printers/name_of_printer. In Windows one simply has to press Add Printer, choose Network Printer and provide the above address. As for printer driver, Generic -> MS Publisher Imagesetter works well:
It worth a note that here we chose to use the specific driver in CUPS, and issued the client to use a generic (postscript) driver. It can be done in the other way around as well: in that case Raw driver has to be chosen when adding the printer on the server and the specific driver has to be installed on the client.
At this point the only remaining task is to have all of these persistent, so have the CUPS daemon started when the device boots up. For this I made the following script based on this one:
#!/bin/sh
MODULE=/lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko
LPNODE=/dev/lp0
CUPSD=/opt/sbin/cupsd
SETUP=/opt/sbin/lpadmin
PRINTER="LaserJet_2300L"
case "$1" in
start)
if ( [ ! -c /dev/lp0 ] ) then
mknod $LPNODE c 180 0
fi
#/bin/chown sys:lp /dev/lp0
if ( !(lsmod | grep "^usblp" -q) ); then
insmod $MODULE
fi
if [ -n "`pidof cupsd`" ]; then
/usr/bin/killall cupsd 2>/dev/null
fi
$CUPSD
$SETUP -p $PRINTER -E
;;
stop)
if [ -n "`pidof cupsd`" ]; then
/usr/bin/killall cupsd 2>/dev/null
fi
;;
*)
echo "Usage: (start|stop)"
exit 1
esac
The script first makes sure that the device node exists and the module is loaded (the rest of the usb modules are anyhow loaded on startup). Then kills all instances of the daemon before starting the new process. Note that the printer has to be specifically enabled by lpadmin -p "printer name" -E which is done just after the daemon started.


