Page 1 of 4
Solved: Archer C7 Wifi button
Posted: Tue Sep 06, 2016 5:35 am
by Adamon
Hello,
recently I installed the latest Gargoyle on my Archer C7 V2 (it is actually a C5 V1.2, but they are practically identical hardwarewise).
The router has an on/off button for Wifi on its backside. It is working with original firmware but not with openwrt/gargoyle. Some search got me to this discussion on the openwrt forum
https://forum.openwrt.org/viewtopic.php?id=56886. The problem was identified to gpio23 not being set. Furthermore, kernel module kmod-input-polldev is required. In the thread a patch was provided.
So I did
Code: Select all
opkg install kmod-input-polldev
ERROR: Dependency kernel (= 3.18.23-1-b2f200610f46d20ef52d269421369d0c) of package kmod-input-polldev is installed,
but has incompatible version 3.18.29-1-3615c37379ca3162465671af3197f04b and is marked as 'hold'
Apparently Gargoyle is not based on the current openwrt release but a slightly newer trunk. What can I do to get this working?
Thank you
Re: Archer C7 Wifi button
Posted: Tue Sep 06, 2016 7:08 am
by Lantis
Build a new firmware with the module pre-installed would be the fastest way
Re: Archer C7 Wifi button
Posted: Tue Sep 06, 2016 11:50 am
by Adamon
Lantis wrote:Build a new firmware with the module pre-installed would be the fastest way
OK

... I should have added that I am an absolut beginner. No idea how to build something with ..... what? And then brick the router with my first new firmware
I am normally not that reluctant to commit myself, but compiling different components for a firmware of my router? Seems to me too risky.
As this problem applies to everybody using the TP Archer C5/7, does someone already looked into this? Quite many here on this forum seem to have this router.
Re: Archer C7 Wifi button
Posted: Tue Sep 06, 2016 11:53 am
by Adamon
I should have said that I do not understand the technical part of this at all. No idea what gpio is, when they are considered "out" or "in" etc.
Re: Archer C7 Wifi button
Posted: Tue Sep 06, 2016 5:04 pm
by Lantis
Ok.
Well we can attempt to solve it the slow way as long as you are comfortable with a few things
1) Failsafe reset procedures
If everything goes belly up you'll need to reset everything
2) SSH and logging into the router.
3) Time difference
We are on opposite sides of the world so any question/answer replies are 24 hours apart.
4) we may end up back at compiling a firmware anyway
If you answered yes to 1, 2, 3 and 4... Please reply back with the output of the following:
With the wifi switch in the off position
cat /sys/kernel/debug/gpio
And with the wifi switch in the on position
cat /sys/kernel/debug/gpio
Re: Archer C7 Wifi button
Posted: Tue Sep 06, 2016 7:15 pm
by tapper
ON:
GPIOs 0-23, ath79:
gpio-12 (tp-link:blue:wlan2g ) out hi
gpio-13 (RFKILL switch ) in lo
gpio-14 (tp-link:blue:system ) out lo
gpio-15 (tp-link:blue:qss ) out hi
gpio-16 (Reset button ) in hi
gpio-17 (tp-link:blue:wlan5g ) out hi
gpio-18 (tp-link:green:usb1 ) out hi
gpio-19 (tp-link:green:usb2 ) out hi
gpio-21 (USB2 power ) out hi
gpio-22 (USB1 power ) out hi
Success
OFF:
GPIOs 0-23, ath79:
gpio-12 (tp-link:blue:wlan2g ) out lo
gpio-13 (RFKILL switch ) in lo
gpio-14 (tp-link:blue:system ) out lo
gpio-15 (tp-link:blue:qss ) out hi
gpio-16 (Reset button ) in hi
gpio-17 (tp-link:blue:wlan5g ) out lo
gpio-18 (tp-link:green:usb1 ) out hi
gpio-19 (tp-link:green:usb2 ) out hi
gpio-21 (USB2 power ) out hi
gpio-22 (USB1 power ) out hi
Success
From my C7 v2 on 1.9.x latest
Re: Archer C7 Wifi button
Posted: Wed Sep 07, 2016 3:15 am
by Adamon
@tapper
from what I understand: gpio-13 (RFKILL switch) refers to the wifi on/off switch.
Your gpio-13 does not change when you turned from off to on. However, apparently both 2.4 an 5 GHz where switched off and on on your device

.
Look at my output:
Code: Select all
Off
root@Gargoyle:~# cat /sys/kernel/debug/gpio
GPIOs 0-23, ath79:
gpio-12 (tp-link:blue:wlan2g ) out lo
gpio-13 (RFKILL switch ) in lo
gpio-14 (tp-link:blue:system ) out lo
gpio-15 (tp-link:blue:qss ) out hi
gpio-16 (Reset button ) in hi
gpio-17 (tp-link:blue:wlan5g ) out lo
gpio-18 (tp-link:green:usb1 ) out hi
gpio-19 (tp-link:green:usb2 ) out hi
gpio-21 (USB2 power ) out hi
gpio-22 (USB1 power ) out hi
ON
root@Gargoyle:~# cat /sys/kernel/debug/gpio
GPIOs 0-23, ath79:
gpio-12 (tp-link:blue:wlan2g ) out lo
gpio-13 (RFKILL switch ) in lo
gpio-14 (tp-link:blue:system ) out lo
gpio-15 (tp-link:blue:qss ) out hi
gpio-16 (Reset button ) in hi
gpio-17 (tp-link:blue:wlan5g ) out lo
gpio-18 (tp-link:green:usb1 ) out hi
gpio-19 (tp-link:green:usb2 ) out hi
gpio-21 (USB2 power ) out hi
gpio-22 (USB1 power ) out hi
As expected no change for gpio 12 and gpio 17, since gpio 13 did not get activated.
Do you have an explanation for the difference between your and my output (mine corresponds to what was reported on the openwrt forum in the above link)?
Do you have kmod-input-polldev installed?
Re: Archer C7 Wifi button
Posted: Wed Sep 07, 2016 3:30 am
by Adamon
Hello Lantis,
that would be great! I like to learn with guidance.
Answering your questions:
Lantis wrote:
1) Failsafe reset procedures
If everything goes belly up you'll need to reset everything I got familiar with it as I already "bricked" my router several times up to no accessibility when testing various firmwares.
2) SSH and logging into the router. Sure. I am on Linux since many years, it is just this router stuff that is entirely unknown to me
3) Time difference Yes
We are on opposite sides of the world so any question/answer replies are 24 hours apart.
4) we may end up back at compiling a firmware anyway GREAT
Lantis wrote:If you answered yes to 1, 2, 3 and 4... Please reply back with the output of the following:
With the wifi switch in the off position
cat /sys/kernel/debug/gpio
It is above in my reply to Tapper.
Thanks for looking into this. The hardware switch for Wifi was one of the criteria to buy this router, I use Wifi mostly for syncing with laptops and when my family is around.
Re: Archer C7 Wifi button
Posted: Wed Sep 07, 2016 5:37 am
by Adamon
I tested gpio-23 with the Wifi button on/off:
Code: Select all
root@Gargoyle:~# cd /sys/class/gpio/
root@Gargoyle:/sys/class/gpio# echo 23 > export
root@Gargoyle:/sys/class/gpio# echo in > gpio23/direction
Wifi button set to off
root@Gargoyle:/sys/class/gpio# cat gpio23/value
0
Wifi button set to off
root@Gargoyle:/sys/class/gpio# cat gpio23/value
1
I assume this means that the Wifi button is assigned to gpio-23?
Re: Archer C7 Wifi button
Posted: Wed Sep 07, 2016 6:52 am
by Lantis
correct.
Ok, can you now please modify the file
/etc/rc.button/gargoyle_button_handler
with the following:
Code: Select all
#!/bin/sh
. /lib/functions.sh
do_button () {
local button
local action
local handler
local min
local max
config_get button $1 button
config_get action $1 action
config_get handler $1 handler
config_get min $1 min
config_get max $1 max
[ "$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
}
config_load system
config_foreach do_button button
Also whilst in that directory, please confirm that an "rfkill" file exists which is a symlink pointing towards the gargoyle_button_handler.
If this is all ok, then go ahead and slide the switch a few times and then do a "logread" and hopefully you will see something to the effect of:
Wed Sep 7 20:47:18 2016 user.notice root: the button was BTN_2 and the action was released
(but hopefully "RFKILL" instead.)
If this is ok, then we can look at the final step which is hooking a wifi event onto this.
If you want to try yourself, i have an example at
http://lantisproject.com/gargoyle_scrip ... oggleCC.sh which is targeted at the WNDR3800, otherwise, we'll go from your next reply.