Hacking the ASUS WL-500g Premium

I've used to prefer an assembled pc with old hardware in place of typical hardware routers and gateways. After years with a debian pc used as router/fileserver/etc i've wanted a silent little machine to do the same things. the ASUS WL-500 was the response, after a week or so i've changed the firmware with x-wrt that is OpenWRT with a much better GUI and some patches.

Surfing the net

No problem at all, i've wireless and wired clients. I use WPA for the wireless connection in the advanced setting i've found that Since OpenWRT RC6 you have to set _wl0_txpwr_ in qdBm (1/4 dBm), so if you want so achieve 20 dBm, you have to set wl0_txpwr to 80.

Shell

Of course you've a perfect shell access with ssh. Busybox have /bin/ash that is a tiny replacement of bash.

Setting the xterm/iterm title : ash doesn't support the COMMAND_PROMPT setting but you can modify the PS1 variable in /etc/profile with hb.

export PS1='\[\e]0;\h:\w\a\]\[\e[0;32m\]\h\[\e[0m\]:\w\$ '

Swap and Disks

I don't use for now any swap file, but i've tested it with a simple USB pendrive and after getting the swap-utils :

http://downloads.openwrt.org/backports/rc5/swap-utils_2.12r-1_mipsel.ipk

ipkg install swap-utils fdisk
fdisk per creare la partizione
mkswap crei il filesys
swapon
ln -s /proc/mounts /etc/mtab

You don't want to take all the time your hd box spinning

I've found two solution, both of them are pretty useful. First, turn off your hd without unmounting is a bad idea and turning on a computer for doing this is a pain. The asus wl500gp have two hardware buttons, the reset and a red button used by the orginal Asus firmware to do ???. With OpenWRT you can remap the function of this button and i've put this script in /etc/hotplug/button/script

#!/bin/sh
#logger "BUTTON=$BUTTON ACTION=$ACTION SEEN=$SEEN"
# TODO: actualy executed two times because
#      i need to check only the press event and not the release
logger "umounting  /mnt/share via red button"
umount /mnt/share

That's all. Magically pressing this button i can umount my disk and after seeing the lamp flashing for the last time i can safely turn off my usb box.
Turning off is cool, but spin down the motor of hd is better. Sadly with the USB interface we can't put the hd in sleep mode with a simple IDE command (issued by hdparm for example). I've found an article that can solve also this issue : http://www.nslu2-linux.org/wiki/FAQ/SpinDownUSBHarddisks. I like the method one, but haven't tried for now.

Webcam

My cam is a Creative NX that can use the spca-lite drivers, perfect for this device. I've followed this tutorial and the cam now works my router : http://www.macsat.com/macsat/content/view/36/30/

Storage

I've attached an USB box and put samba to do the same fileserver that i've with my previous configuration. You must first install the necessary kernel modules for the usb storage and hotplug.

My unresolved problem with storage is the transfer rate, with a 100mbit lan, you can transfer files with other machine at speeds like 8/9 MBs, but with my current USB box i've speeds like 3 MBs. Samba wasn't the bottleneck (uhuh), i've tried also with ftp and sftp with similar speeds. I'm thinking about the USB chipset...

Wireless

I've never used WEP (too unsecure) and i use WPA PSK. With a default OpenWRT install you can't use WPA/WPA2, you need a proprietary package called nas.

Update May 16, 2009

This router is still serving my home lan, perhaps a little over utilized.
Now I've upgraded the old firmware with Kamikaze 8.09 using the MTD method. With the new GUI the router doesn't need any hack for basic use. I've definitively abandoned the idea of using it as a NAS server. I've bought a simple hd with Ethernet interface and I'm happy with it.
Now watching for a possible upgrade of the mini-pci card with a 11n model.

2007-09-02