PLEASE ADD TO AND ORGANIZE THIS PAGE Printer sharing howto
Why should I use printer sharing? What is that?
If you want to share printers with other PCs (clients) in your network, then this is the right howto for you. It was written for the small
p910ndnon-spooling printer server. An alternative would be using the
cupspackage (which is also available) but in my opinion it's too much for the average OpenWrt device (mostly because it needs to cache the print jobs before sending them and because there's not much space for that left without additional storage space).
From the p910nd man page: p910nd is a small printer daemon intended for diskless workstations that does not spool to disk but passes the job directly to the printer. Normally a lpr daemon on a spooling host connects to it with a TCP connection on port 910n (where n=0, 1, or 2 for lp0, 1 and 2 respectively). p910nd is particularly useful for diskless Linux workstations booted via Etherboot that have a printer hanging off them. Common Unix Printing System (CUPS) supports this protocol, it's called the AppSocket protocol and has the scheme socket:. LPRng also supports this protocol and the syntax is lp=remotehost%9100 in /etc/printcap. ====== Requirements ====== * a device supported by OpenWrt with USB and/or parport (the Asus WL-500g has both USB and parport) * a recent OpenWrt version installed (at least Kamikaze 7.07) * configured USB and/or parport modules * the <code>p910nd</code> package * GNU/Linux or Windows clients to connect to your printer server * a USB or parallel printer (TIP: I tested this with a noname USB-to-Parport adapter/converter too, works perfect!) ====== Installation ====== Install the p910nd package: <code> ipkg install p910nd</code> ===== Printers connected via USB ===== To use an USB printer you must first add support for USB printers. First follow UsbStorageHowto to install the USB controller modules if you haven't already done so. You don't need <code>usb-storage</code> for the printer to work. You might need both USB 1.1 and 2.0 installed to support both modes. Additionally, you need the <code>usb-printer</code> module which you can install with <code>ipkg</code> as follows: <code> ipkg install kmod-usb-printer</code> Now plug in the printer, run <code>dmesg</code> and check for the following lines: <code> hub.c: new USB ice 01:02.0-1, assigned address 2 printer.c: usblp0: USB Bidirectional printer 2 if 0 alt 0 proto 2 vid 0x04A9 pid 0x1094 usb.c: USB disconnect on ice 01:02.0-1 address 2 hub.c: new USB ice 01:02.0-1, assigned address 3 printer.c: usblp1: USB Bidirectional printer 3 if 0 alt 0 proto 2 vid 0x04A9 pid 0x1094</code> ===== Printers connected via parport (parallel port/LPT) ===== When you are connecting a parport printer you must install the <code>kmod-lp</code> package which installs the modules for parport support. <code> ipkg install kmod-lp</code> Now you've to reboot your Wrt router. <code> reboot</code> When you see the file <code>/dev/printers/0</code> under linux 2.4 than the installation is done. You can also check the output from <code>dmesg</code> . ====== Configuring the printer daemon ====== The configuration has been migrated to use UCI and is stored in the /etc/config/p910nd config file. You can run more than one printer at the same time by adding additional sections. The default configuration is (list all configured printers): Under Linux 2.4, the device name for the printer would be of the form /dev/usb/lpn. Under Linux 2.6, the device name for the printing would be of the form /dev/lpn <code> uci show p910nd</code> <code> uci set p910nd.cfg1=p910nd uci set p910nd.cfg1.device=/dev/usb/lp0 uci set p910nd.cfg1.port=0 uci set p910nd.cfg1.bidirectional=1 uci set p910nd.cfg1.enabled=1</code> To add a second printer, do this: <code> uci set p910nd.cfg2=p910nd uci set p910nd.cfg2.device=/dev/usb/lp1 uci set p910nd.cfg2.port=1 uci set p910nd.cfg2.bidirectional=1 uci set p910nd.cfg2.enabled=1 uci commit p910nd /etc/init.d/p910nd restart</code> To delete the second printer, do this: <code> uci del p910nd.cfg2 uci commit p910nd /etc/init.d/p910nd restart</code> Description of the options in the p910nd config file (/etc/config/p910nd): ^ Option ^ Value ^ Default value ^ Description ^ | device | /dev/usb/lp0 | /dev/usb/lp0 | The device your printer is connected to (e.g. /dev/usb/lp0, /dev/printers/0 for LPT under Linux 2.4; /dev/lp0 for USB under Linux 2.6) | | port | [0-9] | 0 | The p910nd daemon will listen on TCP port 9100+port | | bidirectional | [1|0] | 1 | 1: Turn on bidirectional copying; 0: Turn off bidirectional copying | | enabled | [1|0] | 0 | 1: Enable the printer; 0: Disable the printer | To start the p910nd daemon, do this: <code> /etc/init.d/p910nd start</code> To start it up automatically on every boot, do this: <code> /etc/init.d/p910nd enable</code> If your printer (mine hl-2030) spits out garbage after poweron, p910nd might be the cause. Add this to /etc/hotplug.d/usb/20-printer <code> #!/bin/sh (-) # Copyright (C) 2006 OpenWrt.org if [ "$PRODUCT" = "4f9/27/100" ] then case "$ACTION" in add) echo "`date`: Brother HL-2030 added" » /tmp/hl-2030 /etc/init.d/p910nd restart » /tmp/hl-2030 echo "Done." » /tmp/hl-2030 ;; remove) echo "`date`: Brother HL-2030 removed" » /tmp/hl-2030 /etc/init.d/p910nd stop » /tmp/hl-2030 echo "Done." » /tmp/hl-2030 ;; esac fi </code> Where "$PRODUCT" = "4f9/27/100" is your printers VendorId/ProductId/BcdVersion(1.00 = 100). Get it with lsusb -v You might need to add "-INT" to the kill command in /etc/init.d/p910nd to actually have the stop work. ====== Configuring the printer daemon with custom-user-startup ====== Following (the original guide V2… below) did not work for X-WRT (OpenWrt White Russian 0.9) on Asus WL-500g. I did the "UCI SET" with many typos and re-did it perfectly finally, but it still didn't work. So i did read DD-WRT guide on the daemon, about d910nd and finally got it working. –(2. )—-(Now create a file into that directory named "usb.startup". In console type "nano" (get nano text edito with package manager or ipkg) to open the nano text editor. Write these lines:)– (for some reasons striked method worked once after reboot, but not after second reboot.. no idea why)–( )– 2. In X-WRT go to System → Startup and add these lines in the box: (you are now editing a custom startup file.. mine was called "/etc/init.d/S95custom-user-startup"): <code> #brother laser /jffs/usr/sbin/p910nd -b -f usb/lp0 0 #canon inkjet /jffs/usr/sbin/p910nd -b -f usb/lp1 1</code> –(Nano has a menu below. You use CTRL+X where X the character from the menu. Just start saving the file, put in the right filename and exit nano.)– NB! correct the usb.startup content to match your setup. -b means bidirectional -f specifices device name The last number can be 0,1 or 2, making the print server listen at port 9100, 9101 and 9102 respectively. And don't forget the " & " mark… read the "custom-user-startup" file comments about that… if there is nothing in your version, then don't bother. For Asus WL-500g with LaserJet 1020 i used this one, and it works: <code> #LaserJet 1020 /jffs/usr/sbin/p910nd -b -f usb/lp0 0</code>
Additional debuging: Check that you have p910nd package installed and there is a file called "p910nd" at "/jffs/usr/sbin/p910nd/" In console check that you have "lp0" listed in "/dev/usb/" dir - if you have something else, use yours. For LPT devices check "/dev/printers/" dir.
Reboot your router and it should work… read below how to set up your printer in the computers. Note: Try removing the '-b' option for p910nd, if it still doesn't work.
Advertising the printer via Zeroconf (optional)
To avoid having to install the printer on multiple clients, you can advertise it via Zeroconf. The following example uses Avahi.
Apple's Bonjour Printing Specification discusses pretty much what needs to be done to advertise a printer over the network:
- the service type is
_pdl-datastream._tcp.
, the "needs a driver" printer type
- the
product
,
pdl,
usb_MFG&
usb_MDLTXT records are required, and can be found in the printer's PPD file - OS X's Printer Setup utility uses these to search for the appropriate driver
- the Apple doc notes that printers that don't provide the LPR service should still advertise that service (as "unsupported"); presumably that involves declaring a second service with a particular key to indicate "unsupported" - don't know how to do this with Avahi
e.g. a Brother HL-2040, a "softprinter" (does not support Postscript or PCL, all processing is done on the client) shared via p910nd:
Create the file
/etc/avahi/services/printer.service:
Brother HL-2040 on %h _pdl-datastream._tcp. 9100 product=(HL-2040 series) pdl=application/vnd.cups-raster usb_MFG=Brother usb_MDL=HL-2040 series note=Study
- the
txt-record
items (except for
note) are from OS X's HL-2040 PPD (
/private/etc/cups/ppd/HL_2040_series.ppd)
- the printer will now show up in any Zeroconf client (tested with OS X 10.4.10)
Configure the clients for printing
Here I would demonstrate you, how to configure the printer driver on your client. It could be that these steps are not exactly the same on your operating system.
NOTE: Remember the ports you configured above. Default is port 9100 for a USB printer on the device
/dev/usb/lp0.
You can check the ports on which
p910ndis listening on with the command
netstat -anexecuted on the router.
We need your help here!Please update this section with more client configurations. This should include a short list howto configure a client. Please do not use screenshots.Thanks.
Linux clients
CUPS
Assuming the printer driver is installed locally, it's a simple matter of entering http://localhost:631 in your favorite web-browser, and pressing add printer under the "Printers" pane. Then:
- Enter something into the information fields and press continue.
- Select "Internet Printing Protocol (IPP)" and press continue.
- Write "socket::". Here you have to fill in the appropriate info in the <> fields. Press continue. * Select the appropriate manufacturer and press continue. * Select the appropriate printer and press continue. * Voila… Then you use your new printer like you would a local one. ==== kprinter (KDE) ==== * Start kprinter * Select 'Add printer' * Select Network printer (TCP) * Use 192.168.1.1 (the router's IP address) as the printer's IP * Fill in the port you want to use (normally defaults to 9100) * Pick manufacturer and model * Pick the recommended driver * Then you can new print a test page or change the settings of the printer further ==== Gnome ==== * Select System → Administration → Printing * Select New Printer * Select Network Printer and "HP JetDirect" * Enter your WRT's IP address and port 9100. * Select your printer's make and model. Continue forward and apply settings. * Check the properties to ensure you are using A4 or US Letter size as appropriate. ===== OS X ===== ==== Version 10.4.6 ==== * select system preferences * Print & Fax * Click on + button * Click on IP Printer * set Protocol: HP Jet Direct - Socket, Address: : and then select brand and printer. * Type a name if you don't want the IP address for a name. * close the Printer Browser. ===== Windows clients ===== ==== Windows 2000/XP/Vista ==== The following instructions should work on all versions of windows from 2000 onwards, and have been tested in both Windows 2000 and Windows Vista. * Install your printer software as you would if it were a local printer. * Go to your printer properties in the control panel/printer settings. * Select the tab "Ports". * Select "Add Port". * Select "Standard TCP/IP Port" and click on "New Port…". * Follow the wizard. In the field "Printer Name or IP Address", enter the IP address of your router. * Windows will send a couple of UDP packets to port 161 of the Router. You can safely discard them. * You will need to select a Device Type. Select "Custom" and click "Settings…". * Be sure the protocol is "Raw" and the port number is correct (i.e. 9100). * Finish the Settings wizard and close the Add Port window. The newly created Port should now be selected. * You printer should be configred now. Be sure that your firewall allows communication to the chosen port. * You may print a test page to see if all went well. ====== Ink level information for inkjet printers ====== Most printer drivers cannot access ink level information through the 910nd deamon, so you may not know, which cartridge to change. You can use the attached ink-4.1 package attachment:ink_0.4.1-1_mipsel.ipk to obtain the ink levels for most printers in OpenWrt (based on http://libinklevel.sourceforge.net/). If you want to display the inklevels in X-Wrt you may apply the following path to status-usb.sh: <code> … end_form EOF ?> <? usbpr=`ls usb/lp* 2>null` if [ ! -z "$usbpr" ]; then inklevel_form=$( for p in $usbpr; do ink -d $p | awk -v FS=":" ' BEGIN { line=0 print "string|<table style=\"width: 90%; margin-left: 2. } { if (line==2) { print "string| @TR«st } if (line >=4) { print "string| " $1 " print "progressbar|inklevel| 200| " $2 "| " print "string|" } line++ } END { print "string|" }' done; ) display_form «EOF start_form|@TR<> $inklevel_form end_form EOF fi; ?> @TR<> … </code> ====== Troubleshooting ====== * Problem : the printer status shows "Attempting to connect to socket::" in the client CUPS interface (http://localhost:631) and nothing works (seen on WL500GP / WhiteRussian RC6).
- Solution : make sure you installed both USB 1.1 and USB 2.0 modules (see UsbStorageHowto).
Not supported printers
Here you should create a list of printers which are not working with the
p910ndpackage. Please include manufacturer, model, interface (USB/Parport), driver working and some short comment.
The combination Windows 2000 with a canon pixma iP4000 seems not to work with bidirectional mode. If your printer dosent work, try disabling bidirectional mode.
Canon Pixma ip3000 and windows xp is not working in bidirectional mode. Disable bidirectional mode.
Please add not working combinations here.
Konica Minolta PagePro 1300W doesn't seem to work in bidirectional mode under win xp.
Canon i560 is not working in bidirectional mode. Remove the -b option on the router and disable bidirectional mode and the Canon Status Monitor in Windows. Make sure that the uhci kernel module is loaded since it seems to be usb 1.1.
Canon MP600 does not work in bidirectional mode on Windows XP using p910nd v0.7. Remove -b from line in /etc/defaults/p910nd and kill/restart the p910nd process. Uses the ehci-hcd module (USB 2.0).
Links
- http://etherboot.sourceforge.net/p910nd/
- http://wl500g.dyndns.org/printing/
- http://wl500g.dyndns.org/
What follows is less than organized
HowTo run HP LaserJet 1018/1020/1022 on OpenWRT Kamikaze 7.06
At first a install foo2zjs drivers from http://foo2zjs.rkkda.com/ on linux box.
It's instruction from http://foo2zjs.rkkda.com/
„Click the link, or cut and paste the whole command line below to download the driver.
$ wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz
Now unpack it:
Unpack:
$ tar zxf foo2zjs.tar.gz
$ cd foo2zjs
Now compile and install it. The INSTALL file contains more detailed instructions; please read it now.
Compile:
$ make
Get extra files from the web, such as .ICM profiles for color correction,
and firmware. Select the model number for your printer:
$ ./getweb 2430 # Get Minolta 2430 DL .ICM files
$ ./getweb 2300 # Get Minolta 2300 DL .ICM files
$ ./getweb 2200 # Get Minolta 2200 DL .ICM files
$ ./getweb cpwl # Get Minolta Color PageWorks/Pro L .ICM files
$ ./getweb 1020 # Get HP LaserJet 1020 firmware file
$ ./getweb 1018 # Get HP LaserJet 1018 firmware file
$ ./getweb 1005 # Get HP LaserJet 1005 firmware file
$ ./getweb 1000 # Get HP LaserJet 1000 firmware file
Install driver, foomatic XML files, and extra files:
$ su OR $ sudo make install
# make install
(Optional) Configure hotplug (USB; HP LJ 1000/1005/1018/1020):
# make install-hotplug OR $ sudo make install-hotplug
(Optional) If you use CUPS, restart the spooler:
# make cups OR $ sudo make cups ”
Next you must transfer sihp1020.dl to your Asus box.
On Asus You should install packages :
ipkg install kmod-usb-printer ipkg install p910nd
When do you have problem with depends kmod-nls-base. You should edit /usr/lib/ipkg/lists and remove depends for your pacage.
Next:
/etc/init.d/p910nd enable /etc/default/p910nd I leave without any changes !!!!
Next you need to create script that uploads the firmware to your printer after you've plugged it it.
Create a new file /etc/hotplug.d/usb/hplj1020:
#!/bin/sh
FIRMWARE="/mnt/pendrive/sihp1020.dl"
< -- place where you have your .dl file.
if [ "$PRODUCT" = "3f0/2b17/100" ]
then
if [ "$ACTION" = "add" ]
then
echo "`date` : Sending firmware to printer..." > /var/log/hp
cat $FIRMWARE > /dev/usb/lp0
echo "`date` : done." > /var/log/hp
fi
You must change parameter 3f0/2b17/100 for your printer.
3f0/517/120 it is idVendor/idProduct/bcdDevice, from device descriptor. Numbers are hexadecimal, without leading '0x' or zeros.
This parameters you can get from ls with v option. More info you can find at http://linux-hotplug.sourceforge.net/?selected=usb .
Using WRT54G(S/L) SES button for Radio Control
This is a remake of a code that is found on http://wiki.openwrt.org/OpenWrtDocs/Customizing/Software/WifiToggle
Step 1: Create the button/ folder inside /etc/hotplug.d/ if it doesn't exist
Step 2: cd to this dir and edit a new file named 01-radio-toggle
Step 3: Paste this code inside the file
if [ "$BUTTON" = "ses" ] ; then
if [ "$ACTION" = "pressed" ] ; then
WIFI_RADIOSTATUS=$(wlc radio)
case "$WIFI_RADIOSTATUS" in
0)
echo 2 > /proc/diag/led/power
wlc radio 1
wifi
echo 1 > /proc/diag/led/ses_white
echo 1 > /proc/diag/led/power ;;
1)
echo 2 > /proc/diag/led/power
wlc radio 0
echo 0 > /proc/diag/led/ses_white
echo 2 > /proc/diag/led/wlan
echo 1 > /proc/diag/led/power ;;
esac
fi
fi
Step 4: Save the file and just test it, it will light Wlan and White SES Led when radio is on, and turn both off when radio is off
CUPS - Printing system with spooling (A second "approach")
You can't print a testpage on the local cups, because this would need to have ghostscript installed on your embedded system.
If you have a special Postscript Printer Description (ppd) file for your printer, copy it to /usr/share/cups/model/ and restart cupsd. Cups will install it in /etc/cups/ppd and you can choose it via the web interface. (192.168.1.1:631)
If you have problems with permissions, try to change /etc/cups/cupsd.conf to fit your local TCP/IP network:
Order Deny,Allow Deny From All Allow from 127.0.0.1 Allow from 192.168.1.0/24 #your ip area.
MacOS X tip: Configure your extended printer settings. If you use the standard printer settings and add an IPP printer, MacOS X will add after the server adress /ipp . But this class etc. does not exist on your cupsd.
oldwiki/openwrtdocs/kamikaze/printers.txt · Last modified: 2009/04/23 12:36 (external edit)

