PDA

Bekijk de volledige versie : How to disable Wireless when pressing ez setup button?



Zapt
07-06-2007, 10:19
Since I am using other wireless devices like a phone or a tv transmitter that also uses 2,4GHZ I want to be able to switch off the wireless by pressing the ez setup button.
As far as I have come is to create a file named ez-setup which is supposed to be run when the button is hit.
Is it normal, that there is no ez-setup script in the first place?
I am using Oleg's G-Firmware...
How am I able to switch off the wireless or to just lower the wireless power?

beatmag
07-06-2007, 14:27
the latest firmware provides you a chance to script your own code in the ez button.
I have yet to do this, since I am still on an older firmware.
Though all you have to do is perform
the commands

'wl down'
or
'wl up'

and just toggle between the two.
I will try soon.

Zapt
08-06-2007, 00:38
Here is my code for switching between the two modes. Maybe you know a nicer way to do this..


#!/bin/sh
#Script by zapt @ wl500g Board
#test, if wireless powered off
if [ -f /usr/local/sbin/poweroff ]; then
echo "Wireless was down, powering up!" && rm /usr/local/sbin/poweroff && wl up
else
#test, if wireless powered on
echo "Wireless was up, powering down!" && touch /usr/local/sbin/poweroff && wl down
fi

KGy
08-06-2007, 06:14
Hi, sorry my english.

why

if [ -f /usr/local/sbin/poweroff ]; then
???



#!/bin/sh
WLAN=`wl isup | grep -c "(on)"`
if [ "$WLAN" = "0" ]; then
echo "Wireless was down, powering up!" && wl up
else
#test, if wireless powered on
echo "Wireless was up, powering down!" && wl down
fi


George

Zapt
08-06-2007, 08:39
See that's something I didn't know that you could do!
Thanks for the update!

Zapt
09-06-2007, 08:52
Don't forget to put a "!" after the "#" in your code!

It didn't work when I just copied and pasted it!!

beatmag
09-06-2007, 09:27
now the issue is does wl down

really turn the wireless radio off???????????
or is it

wl radio off?

Zapt
09-06-2007, 14:00
It really does what it is supposed to!
I checked it with kismet running on my laptop.
Also the "AIR" LED stops working when wireless is shut off!
So everything works as I wanted it to! Even stopping and restarting wlan works without any problems.
I am writing this while connected to it via wlan.
Oh, and don't forget to do the usual flashfs enable etc...

KGy
09-06-2007, 20:31
Hi. Sorry my english.
In my router (wl-500g, oleg-7f fw) the "wl down" command not working and "up", too. "wl radio on" or "off" working.
And "wl isup" working, too.
George

beatmag
10-06-2007, 09:26
i replaced the wl down
with wl radio off........

i feel that wl radio down really turns the wifi off....properly....

beatmag
17-06-2007, 02:48
hi all,

I have noticed my wireless coming on by itself =((((((((
Is this due to the date/time enable in the web config?

Can someone help me?
I think it doesn't happen everynight, but today it has. I've noticed it twice.....

after I have performed a wl radio off

its come back on by itself =(

al37919
17-06-2007, 06:22
check the log, may be it has rebooted itself because of power failure or whatsoever.

beatmag
17-06-2007, 08:46
check the log, may be it has rebooted itself because of power failure or whatsoever.

no thats not the case, because my scripts on boot , will disable it with wl radio off too,

my rtorrent was still running too.

I just dont understand why its on...... =( The only reason I can think of is that the ez script gets run.....mistakenly....

have you's noticed that your wifi came on, without you knowing?

Zapt
05-05-2008, 08:13
Since I upgraded to the newest firmware this script doesn't work anymore... Does somebody have a fix?

Serpent
13-05-2008, 20:02
This is because "wl isup" has changed his output in -10 FW.

You only need to change:
WLAN=`wl isup | grep -c "(on)"`
with
WLAN=`wl isup`

And with syslog located in /opt/var/log this is my /usr/local/sbin/ez-setup:

#!/bin/sh
WLAN=`wl isup`
if [ "$WLAN" = "0" ]; then
time=`/bin/date '+%b %e %H:%M:%S'`
echo "$time: Wireless was down, powering up!" >> /opt/var/log/syslog.log && wl radio on
else
time=`/bin/date '+%b %e %H:%M:%S'`
echo "$time: Wireless was up, powering down!" >> /opt/var/log/syslog.log && wl radio off
fi