How to disable the radio whenever possible
Hi!
I wanted to switch off the radio by using the ez-setup button.
Here is how I approached the question.
login (via telnet or ssh)
create /usr/local/sbin/ez-setup :
----
#!/bin/sh
TIMEOUT=45
if [ $(wl radio) = "0x0000" ]; then wl radio off; exit; fi
wl radio on
C=$TIMEOUT
while [ $C -gt 0 ]; do
printf "\x02" > /dev/gpio/out
sleep 1
printf "\x00" > /dev/gpio/out
sleep 1
if [ $(wl radio) = "0x0001" ]; then exit; fi
if [ $(wl assoclist | wc -l) -gt 0 ]; then
C=$TIMEOUT
else
C=$(($C-1))
fi
done
wl radio off
----
then
chmod +x /usr/local/sbin/ez-setup
echo "sleep 25; wl radio off" >> /usr/local/sbin/post-boot
flashfs save && flashfs commit && flashfs enable && reboot
After you turn on the WL500gp, the radio is switched off. To turn it on, you have to press the ez-setup button for a few seconds. The power led starts flashing (I could not control the air led that is always on, even if the radio is off, at least with the firmware version I am using). If within 90 seconds (2*45, but you can change this value) one client connects to the ssid the connection is maintained otherwise the radio is turned off again.
As long as at least one client is connected, the radio is kept on.
After all clients are disconnected the radio is turned off again.
If you have comments or suggestions, feel free to open a discussion.
Cheers,
Luca
NICE SOLUTION but ...PLEASE COULD YOU...
Hi all ,especially knulp79 ,
I am interested in your solution with wifi radio on /off part on this WL-500gP V2 (oleg last firm 10),
but I dont understand the right commands step by step to do it right.
so COULD you PLEASE write a small TUTORIAL how to make this your idea easy for non linux programming people ?
just write where can I find the command line and so on ...
mabye all thru putty ? or some part thru system setup /system command thru web router managememnt ?? ...
mabye not write create a file ...but exactly mkdir ... THANKS for your HELP to make this tutorial easy for SMART PEOPLE ...
OR ANYONE who understand or have these 5min to write it on base of knulp79
THANKS ,thanks thanks a lot ...
I think I am not alone who is looking for it ... :))
wifi led working disable other
Hy in this new (latest version) of oleg wifi led it turns off and on with the wireless device , so i do not need the power led to blink, wich line i take it out from the original code here to stop the power led blinking ??
10x
BTW , great work with ez button
How to turn wireless on / off with EZ-SETUP button
Quote:
Originally Posted by
tmsulica
Hy in this new (latest version) of oleg wifi led it turns off and on with the wireless device , so i do not need the power led to blink, wich line i take it out from the original code here to stop the power led blinking ??
I don't know what you mean by the original code.
I'm using 1.9.2.7-d-r740 and the wireless led turns on/off automatically with 'wl radio on' and 'wl radio off' commands.
Here's a simple script which turns wireless on/off and logs the event to syslog when ez-setup is pressed:
Code:
#!/bin/sh
WLAN=`wl isup`
if [ "$WLAN" = "0" ]; then
logger -t EZ-SETUP "button pressed: wireless turned ON" && wl radio on
else
logger -t EZ-SETUP "button pressed: wireless turned OFF" && wl radio off
fi
Edit: and the script in question is of course /usr/local/sbin/ez-setup