OpenWrt Forum Archive

Topic: Wifi toggle by QSS button on TP-link TL-WR741ND

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi, I succedeed in flashing the firmware of my TP-link TL-WR741ND with openwrt Backfire (r22689).
Now I really need to enable toggle on/off of wireless directly from the Frontal QSS button, but I don't know how to do it.

Following the Wiki I succedeed in reading the gpio 12 (qss button) value and I noticed that normally is 1 and when pressed it goes to zero.

I want to write  a script that checks the status of the button and when pressed enable the wifi is it was previously disabled and viceversa.

Now I need to know the command line command to get the wifi status (if it is ON or OFF) Is there any way to know if wifi is up or down by using a simple command?

and the command line to enable and disable it (wifi up and down works but I need to read the wifi status) or is there an alternative?

By using the procedure described in the wiki I need to unload the module gpio_buttons this can cause any problem?

I found a package called wifitoggle can't I use it? and how?

Thank you

Andrea

#!/bin/sh

[ "$BUTTON" = "BTN_1" ] && [ "$ACTION" = "pressed" ] && {
 SW=$(uci get wireless.@wifi-device[0].disabled)
 [ $SW == '0' ] && uci set wireless.@wifi-device[0].disabled=1
 [ $SW == '0' ] || uci set wireless.@wifi-device[0].disabled=0
 wifi
}

these script in /etc/hotplug.d/button/01-onoff  (if button is called BTN_1)

Or just install wifitoggle package.

See also http://eko.one.pl/?p=openwrt-button (in Polish, sorry)

Ok thank you very much it seems to work properly.
I follow the instruction on the polish site (traslated by google) and I found that QSS button is BTN_1 and reset is BTN_0.
So i copy and paste the simple script you gave me and it worked out of the box
thank you very much
Andrea

Since that prove useful can this button be used for reboot?

Hey .
I got the WR1043ND and I was wondering if I could use the QSS button to start and stop the transmission daemon? And program the QSS led to Be on when the transmission daemon is on? And off when its off?

The discussion might have continued from here.