Warning: this article may out of date, I found another way to setup a socket printer officially supported by OpenWRT: p910nd
Printing through network is very convenient since everyone in the office can share the printer. We have a strong WIFI router running OpenWRT, and I found that the CUPS system was included in the package manager. But I quickly noticed it was not an easy work. Lets write the progresses down.
Second, ssh to the router and edit this file: /etc/hotplug.d/usb/20-hplip
Insert one line:
DEVICE=`echo $DEVICE | sed s/proc/dev/g`
And modify the $PRODUCT value to match your own printer
If this configuration is not right, cups would have insufficient rights to write to the printer through USB device and would get an error: "prnt/backend/hp.c 745: ERROR: open device failed stat=12" in the system log.
P.S. If you got this error: "io/hpmud/musb.c 136: unable get_string_descriptor -1: Operation not permitted", it means the USB device corresponding to the printer had been opened by another process. In my case, it was opened by the kmod-usb-printer(general printer driver), so just uninstall it and the problem was solved.
After finishing the config through "Continues", all the setups on the server-side is done!
Next we should add network printer on the client side: Mac OS X/Linux/Windows.
Linux is the most hard part. I'm using a Debian Linux 7.0 as my Desktop, After a lot of search, I found that the CUPS server must be installed on the client Linux too! And the proper HP printer driver must be installed too!
Openprinting.org said the recommended deriver for my printer(HP-LaserJet Pro P1566) is foo2zjs-z2, and yes, its absolutely right! I installed two other HP derivers: hpcups(through hplip) and hpijs, both failed with status "/usr/lib/cups/filter/hpcups failed", and logged "printer-state-reasons=hplip.plugin-error".