WiFi button not supported

Suggest improvements and new features for Gargoyle.

Moderator: Moderators

wazahuis
Posts: 9
Joined: Tue Jun 09, 2015 6:18 pm

WiFi button not supported

Post by wazahuis »

Hi,

Just got a NetGear router. These have a WiFi button that turns the WiFi off or on without having to log into software. Great for kids if you want to turn off their access fast or on etc.

Unfortunately those buttons don't work with Gargoyle. I would assume this would be a fairly simple feature to support?

harptastic
Posts: 2
Joined: Tue Jun 09, 2015 6:28 pm

Re: WiFi button not supported

Post by harptastic »

I too have recently install Gargoyle onto my NETGEAR WNDR3800 and love all the features. However, I cannot find a way to enable the wifi button on the front of the router. If anyone know of a way that would be greatly appreciated. :D

nworbnhoj
Posts: 916
Joined: Mon Jul 21, 2014 10:08 am
Location: Australia
Contact:

Re: WiFi button not supported

Post by nworbnhoj »

wazahuis wrote:Just got a NetGear router. These have a WiFi button that turns the WiFi off or on without having to log into software. Unfortunately those buttons don't work with Gargoyle. I would assume this would be a fairly simple feature to support?

It will depend entirely on OpenWRT support as Gargoyle is built on OpenWRT.

http://wiki.openwrt.org/toh/start#netgear

What model router are you using?
Can you help someone else get Gargoyle up and running?
TL-WDR3600 : Gargoyle 1.9.0 : NBN FixedWireless
TL-WR1043ND-V2 : Gargoyle 1.8.0 : 3G Huawei E160E

wazahuis
Posts: 9
Joined: Tue Jun 09, 2015 6:18 pm

Re: WiFi button not supported

Post by wazahuis »

I am using Netgear WNDR3800

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: WiFi button not supported

Post by Lantis »

we can get you both up and running if you are willing to do some very basic coding.

You will need:
PuTTY.exe (or your favourite SSH client)
WinSCP

log into your router with both of these programs, defaults are:
hostname: 192.168.1.1
port: 22
username: root
password: yourpassword

in WinSCP make sure you set File Protocol to SCP, and also tell it to remember your password for the session or you will be typing it over and over.


in WinSCP navigate to "/etc/hotplug.d/button"
and open "00-button" for editing.

add the following line as shown:

Code: Select all

logger the button was $BUTTON and the action was $ACTION

Code: Select all

	[ "$ACTION" = "$action" -a "$BUTTON" = "$button" -a -n "$handler" ] && {
		[ -z "$min" -o -z "$max" ] && eval $handler 
		[ -n "$min" -a -n "$max" ] && {
			[ $min -le $SEEN -a $max -ge $SEEN ] && eval $handler 
		}
	}
	logger the button was $BUTTON and the action was $ACTION
}
i.e. make sure it goes between the 2nd last and last braces.
Save and close, wait until the changes have uploaded.

go and press the button on your router that you wish to have as your wifi toggle button.
in PuTTY, type "logread".
look for the following phrase
"user.notice.root: the button was XXX and the action was pressed/released"
write this button name down exactly as stated, we will need it soon. for the fellow with the WNDR3800 it should be BTN_2.

now in PuTTY type
cd /etc
touch wifitoggle.sh
chmod +x wifitoggle.sh

using WinSCP, find the file "wifitoggle.sh" in /etc and put the following into it

Code: Select all

#!/bin/sh

STATUS=`wifi status | grep -m 1 up | sed -e 's/^[ \t]*//' -e 's/"up": //'`

if [ "$STATUS" == "true," ]; then
	wifi down
	logger Wifi button pressed, wifi going down
else
	wifi up
	logger Wifi button pressed, wifi going up
fi
now back to PuTTY (i promise we are almost done) issue the following commands

uci set system.wifi_toggle=button
uci set system.wifi_toggle.button=BTN_2 <-- or whatever the name of the button was we found earlier
uci set system.wifi_toggle.action=pressed
uci set system.wifi_toggle.handler=/etc/wifitoggle.sh
uci commit system


test it out and see what happens.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

harptastic
Posts: 2
Joined: Tue Jun 09, 2015 6:28 pm

Re: WiFi button not supported

Post by harptastic »

Thanks for that information but it sounds like a lot of messing around, but it's good that you can add features like that.
Also I've had a look but was unable to find a plugin that could do the same. I was wondering if there was a plugin somewhere that would not be router dependant or have I missed some info on what plugin can and cannot do.

Thanks Heaps

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: WiFi button not supported

Post by Lantis »

Any plugin that implemented this feature would do it the same way I did, just making the process automated.

They would probably use a nicer detection method though. I used the first thing I could think of.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

wazahuis
Posts: 9
Joined: Tue Jun 09, 2015 6:18 pm

Re: WiFi button not supported

Post by wazahuis »

So no plug-in's available to do this?

I would be happy for someone to code this up and pay for it and you could give me a price? And then it can become public domain.

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: WiFi button not supported

Post by Lantis »

Which netgear router did you have?
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

wazahuis
Posts: 9
Joined: Tue Jun 09, 2015 6:18 pm

Re: WiFi button not supported

Post by wazahuis »

I have a NETGEAR WNDR3800

Post Reply