WL500Gp tips: LED, Buttons, VLANs, USB-WLan, better web interface..

I’ve already mentioned the Asus WL500G premium wireless lan router in previous posts. Now I finally found some time to write about a few nice tips&tricks for the device: Reacting to button actions, turning the LED on/off by software, configuring VLANs on the different LAN interfaces, using an USB WLan stick with it and switching to a better web interface.

Reacting to button actions: That’s easy, the device has two buttons, EZSETUP and RESTORE. We will only react to the “EZSETUP” button, as that one’s easier to press. The current state can be read from /dev/gpio/in and will change when one of the buttons is pressed/released. Note that the LEDs are also switched via GPIO, therefore you’ll notice some issues when you keep reading the state and turn the LED on/off (see below). All we need to act on pressing the EZSETUP button is the following litte script – note that the characters might be different depending on your setup:

#!/bin/sh

while : ; do
if [ “$(head -c1 /dev/gpio/in)” = “ü” ]; then
echo pressed
else
echo released
fi
sleep 1
done

LEDs: The status of the power LED can be set by writing 0 or 1 to /proc/diag/led/power. To get the current setting just read the value.
VLANs: By default the LAN ports form a VLAN that’s bridged to the wireless lan interface (eth2) via br0. You can use the standard bridge tools to control this behaviour, e.g. brctl delif br0 eth2. The VLANs can be configured by interacting with /proc/switch/eth0/vlan/[number]/ports. By default ports 1-4 are in vlan0 and port 0 is in vlan1. Port 5 is in all vlans, as this is the internal tagged port towards the internal network interface (note the “t” in the ports files). Good documents describing this behaviour can be found here and here.
Using a USB Wlan stick: You for sure know these little wlan sticks that can be plugged into the USB port to get wlan access? What about plugging one into the Asus and connecting to a wlan while playing AP with the “real” antenna?
To use a wlan stick (DLINK DWL-122) we need support for wlan-ng in the kernel. To accomplish this the corresponding modules need to be built within the OpenWRT build environment. After this is done don’t forget to copy both the modules (p80211 and prism2_usb), the wlanctl-ng utility and (!) the contents of /etc/wlan onto the access point. The /etc directory is necessary because firmware files are being loaded into the wlan stick when the module is being loaded – if they can’t be found the stick won’t work. Load the modules the same way you would e.g. on your laptop:

insmod p80211
insmod prism2_usb prism2_doreset=1
wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable
wlanctl-ng wlan0 lnxreq_autojoin ssid=somewlan authtype=opensystem
(or)
wlanctl-ng wlan0 dot11req_start ssid=moo bsstype=independent beaconperiod=100 dtimperiod=3 cfpollable=false cfpollreq=false cfpperiod=3 cfpmaxduration=100 probedelay=100 dschannel=3 basicrate1=2 operationalrate1=2

Don’t forget to “ifconfig wlan0 up” your new wlan interface πŸ˜‰

Better webinterface: Just install X-Wrt as described here.

Some additional suggestions: Add “src backports http://downloads.openwrt.org/backports/rc6” to your /etc/ipkg.conf to get access to some nice backported packages. Add multiple ip addresses to your AP by using ip aliases, e.g. “ifconfig br0:1 192.168.123.5 netmask 255.255.255.0” – and run a dhcp client on the WAN port. Oh, and init scripts that automatically add IP addresses, react to USB sticks plugged into the usb ports (just read the kernel message buffer with dmesg, if you find a matching USB device load the modules..) and automatically start an adhoc wlan can be useful, too πŸ™‚

Comments are closed.