Mirzad

Jan 212012
 

Its quite easy, here are the ressources I used:

Flash Guide
Printer Sharing
Additional Printer Sharing Info
jffs mount problem thread7
ipkg update problem thread

Since you may want to use the DD-WRT big or mega builts, you need a USB-HUB and USB-Stick in addition to the WRT610N.

For v1 (which I have, you can tell by the serial having xx01…):

– Do a 30/30/30 reboot
– Flash r14929 dd-wrt.v24_mega_wrt610n.bin
– Do a 30/30/30
– Flash a newer one (17990 works fine for me – r17990/broadcom_K26/dd-wrt.v24-17990_NEWD-2_K2.6_mega.bin)
(- Do not use nv60k or nv64k, you dont have enough nvram)
(- Watch for Broadcom_K26 releases on BrainSlayer/eko)
– Finished

Setting up printer sharing:
– In Administration->Management enable jffs and clean jffs
– In Services->USB enabled everything (Core USB, USB Printer, USB Storage, Auto Drive Mount, make it mount to “/jffs”)
– Reboot
– Log in via SSH and check “mount” if there is something mounted rw on /jffs

– In order to do “ipkg update” you have to do “mkdir -p /jffs/tmp/ipkg” (because you have samba in /jffs)

– Get a new printer driver package (wget -c “http://downloads.openwrt.org/snapshots/trunk/brcm47xx/packages/p910nd_0.95-2_brcm47xx.ipk”) and install it (ipkg install p910nd_0.95-2_brcm47xx.ipk) (its around 6kB)

(Copy and pasted from wl520gu:)
– Create a script to start the print server when the printer is on.
Next we will create a script that will check if the printer is on, and if it is, start the print server. It will also stop the server if the printer is turned off. Change to the jffs directory by running cd /jffs and hitting Enter. Type wget http://wl520gu.googlepages.com/watchprinter to download the script. We must make this file executable so it can be run. Type chmod +x /jffs/watchprinter and hit enter. If you run ls you will see that watchprinter is shown in green to indicate an executable file.

Step 5: Create a cron job to start the watchprinter script.
This cron job will run the watchprinter script once every minute. Log into dd-wrt using your web browser. Go to the Administration tab. Scroll down to cron and make sure it is enabled. Put the following command in the Additional Cron Jobs text area and then apply the change.

* * * * * root /jffs/watchprinter

– In addition i had to “mknod -m 660 /dev/usb/lp0 c 180 0”
– Further the printserver wasnt running/starting. “/jffs/etc/init.d/p910nd start” gave me “/bin/sh: can’t open ‘/etc/rc.common'”. So i put “#!/bin/sh” at the top of “/jffs/etc/init.d/p910nd”
– Add the above command to the Administration->Commands edit box and click “Save Startup”.

– See http://www.dd-wrt.com/wiki/index.php/Printer_Sharing#Workstation_setup for how to add the printer to your computers

EDIT: I further improved the watchprinter skript to this:

#!/bin/sh
if [ -z "`pidof p910nd`" ]; then
  [ -e /dev/usb/lp0 ] &&  /jffs/usr/sbin/p910nd -b -f /dev/usb/lp0 0
else
  [ -e /dev/usb/lp0 ] || killall p910nd
fi

if [ -e /dev/usb/lp0 ]; then
 echo ok
else
 mknod -m 660 /dev/usb/lp0 c 180 0
fi

NETSTAT=$(netstat -an | grep ":9100 " | wc -l)
if [[ "$TMP" != "0" ]];
 then
  echo ok
 else
  echo "we have no listener on port 9100, do we?"
  /jffs/etc/init.d/p910nd restart
fi

exit 0