How to install alternative firmware and enable USB printing support on the ASUS WL-520gU
For the initial flash we will use the Asus specific build. After installing that, we can upgrade to the USB build. The most recent "stable" build (v24-SP1) does not include USB support. The latest SVN builds are posted here. Choose the latest build and use the files from the broadcom folder since Asus uses broadcom chips. Download the lastest dd-wrt.v24_mini_asus.trx for the initial flash and dd-wrt.v24_usb_generic.bin for upgrading to USB later.
The CD that comes with the router contains the Asus Firmware Restoration Utility. We will use it to flash the router. You can also download the utility from the Asus website. If you are using Windows Vista you may have to run this tool as Administrator. If you do not want to use the Asus tool you can use a different TFTP client instead. http://www.dd-wrt.com/wiki/index.php/Asus_TFTP_Flash
Set a static IP like 192.168.1.10, Subnet Mask 255.255.255.0 Gateway and DNS can be left blank. More detailed instructions are here: http://portforward.com/networking/staticip.htm
Unplug the power cable from the router. Open the Asus Firmware Restoration Utility. You may have to disable the Windows Firewall for it to work. Make sure you enable it again when you are done. Choose the dd-wrt.v24_mini_asus.trx file you downloaded earlier.
You should have the power cable on the router unplugged. You will need a pen or a paper clip to press the black reset button. (not the red EZsetup button) Hold down the reset button while connecting the power cable. The power LED will flash to indicate that the router is in recovery mode and you may release the reset button. Start the upload from the Asus tool on your PC. It will flash the firmware and the router will automatically reboot when it is finished. Remember to undo your static IP settings and enable your Windows Firewall again.
After installing dd-wrt, the nvram values from the default firmware are still left in the router. You can clear them by logging in with telnet and running erase nvram and then typing reboot.
NVRAM is where settings are stored. DD-WRT will recreate the values it needs at boot. It is a good idea to clear the nvram after upgrading your firmware, or if you are having problems. You can view the contents of the nvram by typing nvram show.
DD-WRT can be accessed at 192.168.1.1 using a web browser. The default username is root and the password is admin but you will be asked to change these. The username will always be root in telnet or ssh, even if you changed it in the GUI.
The mini build we installed does not have USB support. If you want to use the USB port on your router, you will have to upgrade to a USB build such as dd-wrt.v24_usb_generic.bin. Once dd-wrt is installed, it is easy to upgrade. Simply use the Administration->Firmware Upgrade tab in dd-wrt.
Enable JFFS by following these instructions. You can verify that jffs is writable by running mkdir /jffs/test. Run ls /jffs to see a list of files in jffs. If you can see the test folder, you know jffs is writable. You can delete the test folder with rmdir /jffs/test.
Go to the Services tab in dd-wrt and enable Core USB Support, USB 1.1 Support (UHCI), USB 1.1 Support (OHCI), USB 2.0 Support, and USB Printer Support. Remember to click apply.
Enabling USB Printer Support does not install a print server. We will install a print server called p910nd. The version in the dd-wrt package repository is outdated, so we will install the latest version manually. The router must be connected to the Internet for this to work.
Log into the router using telnet or ssh. The username is always root and the password is whatever you set in the GUI. After logging in, we will download the package using wget. Use this command:
This will download the package into a temporary directory. To install it we will use the command ipkg install p910nd_0.95-2_brcm47xx.ipk You can safely ignore the ERROR: File not found: messages for this manual installation.
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.
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
Add a new printer, choose Local Printer. Choose Create a new Standard TCP/IP Port. Set the IP address to the IP of the router. (192.168.1.1 by default) Protocol should be RAW, Port number 9100. Install the correct drivers for the printer. For other operating systems read here.
Note: Be sure to create a new printer. Do not modify an existing one.
You can verify that p910nd is running by using the ps or top commands.
I had problems with corrupt pages being printed. The first page would be fine but all the following pages would be printed incorrectly. I solved this by turning off Enable advanced printing features on the Advanced tab of the printer properties in windows.
If you experience printing problems, it may help to remove the -b switch from the third line of the watchprinter script using vi. Here is a guide for basic vi usage.
Multifunction printers should print fine but scanning to the PC will not work when the device is connected to the router.
USB storage support is beyond the scope of this tutorial but the following wiki pages may be helpful. http://www.dd-wrt.com/wiki/index.php/USB_storage http://www.dd-wrt.com/wiki/index.php/HDsamba2 It is possible to use both USB storage and a printer by installing a USB hub.
Questions? Ask in the dd-wrt forums. My user name is techie1 there.
Thanks to rseiler and frater in the dd-wrt forums. Page updated July 04, 2010