OpenWrt Forum Archive

Topic: Archer C7 V2 wireless switch on/off

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

On my Archer C7 with cc  r45474 the wireless switch on the rear of the router does not work.
It seems, that no Event is generated.
the wps/reset button is working fine.
Any ideas ?

Also interesting for me, is to know, if the wireless switch is working on your side.
Maybe i forgot to add some modules during compile ...

Switching to "on" results in:
root@OpenWrt:~# 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

Switching to "off" results:
root@OpenWrt:~# 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


There must be something wrong with gpio-13 ....

Rampler wrote:

gpio-13  (RFKILL switch       ) in  lo
...
There must be something wrong with gpio-13 ....

Just tested it on mine, same result: the RFKILL stays "lo".
Currently mine is running r44972).

I tested a bit, and on an Archer-C7 v2 GPIO13 is not connected to that switch, its GPIO23.

You can test for yourself:

cd /sys/class/gpio
echo 23 > export
echo in > gpio23/direction

...

root@ap1:/sys/class/gpio# cat gpio23/value
0
root@ap1:/sys/class/gpio# cat gpio23/value
1

https://wiki.openwrt.org/doc/devel/add.new.device#gpios



I patched & compiled a kernel for mine, and afterwards both "buttons" are working:

Sun Apr 19 09:03:50 2015 user.notice root: the button was wps and the action was pressed
Sun Apr 19 09:03:50 2015 user.notice root: the button was wps and the action was released

Sun Apr 19 09:04:32 2015 user.notice root: the button was rfkill and the action was pressed
Sun Apr 19 09:06:00 2015 user.notice root: the button was rfkill and the action was released

Patch (works for me using an Archer C7 v2, warning - could possibly break Archer C7v1 or Archer C5):

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c
index fc12513..d93dab2 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c
@@ -50,7 +50,7 @@
 #define ARCHER_C7_GPIO_LED_USB1                18
 #define ARCHER_C7_GPIO_LED_USB2                19
 
-#define ARCHER_C7_GPIO_BTN_RFKILL      13
+#define ARCHER_C7_GPIO_BTN_RFKILL      23
 #define ARCHER_C7_GPIO_BTN_RESET       16
 
 #define ARCHER_C7_GPIO_USB1_POWER      22

Could someone using an Archer-C7 v1  or Archer-C5 verify if this doesnt break anything for their routers? I assume the GPIO Pins are only changed for Archer-C7 v2 ...

@ninno
Great Job... wink

Unfortunetly i see no change for gpio23 on my side.
I suspect, i miss some modules, because i'm using a custom build.

Would you please so Kind to list your installed modules:
root@OpenWrt:/sys/class/gpio# opkg list-installed
base-files - 157-r45483
busybox - 1.23.2-1
dnsmasq - 2.73rc4-2
dropbear - 2014.65-2
firewall - 2015-02-26
fstools - 2015-04-14-e6004000ff15d7bd32cf5663e8690fc94d7ec747
hostapd-common - 2015-03-25-1
ip6tables - 1.4.21-1
iptables - 1.4.21-1
iw - 3.17-1
iwinfo - 2015-03-23-40f2844fadc05f4a4de7699dbc12fee295b7057b
jshn - 2015-03-22-b8d9b382e39823850331edc2a92379173daf1be3
jsonfilter - 2014-06-19-cdc760c58077f44fc40adbbe41e1556a67c1b9a9
kernel - 3.18.11-1-1626a5485dd815ad757ec9d104664202
kmod-ath - 3.18.11+2015-03-09-3
kmod-ath10k - 3.18.11+2015-03-09-3
kmod-ath9k - 3.18.11+2015-03-09-3
kmod-ath9k-common - 3.18.11+2015-03-09-3
kmod-cfg80211 - 3.18.11+2015-03-09-3
kmod-crypto-aes - 3.18.11-1
kmod-crypto-arc4 - 3.18.11-1
kmod-crypto-core - 3.18.11-1
kmod-gpio-button-hotplug - 3.18.11-1
kmod-ip6tables - 3.18.11-1
kmod-ipt-conntrack - 3.18.11-1
kmod-ipt-core - 3.18.11-1
kmod-ipt-nat - 3.18.11-1
kmod-ipv6 - 3.18.11-1
kmod-ledtrig-usbdev - 3.18.11-1
kmod-lib-crc-ccitt - 3.18.11-1
kmod-mac80211 - 3.18.11+2015-03-09-3
kmod-nf-conntrack - 3.18.11-1
kmod-nf-conntrack6 - 3.18.11-1
kmod-nf-ipt - 3.18.11-1
kmod-nf-ipt6 - 3.18.11-1
kmod-nf-nat - 3.18.11-1
kmod-nf-nathelper - 3.18.11-1
kmod-nls-base - 3.18.11-1
kmod-ppp - 3.18.11-1
kmod-pppoe - 3.18.11-1
kmod-pppox - 3.18.11-1
kmod-slhc - 3.18.11-1
kmod-usb-core - 3.18.11-1
kmod-usb2 - 3.18.11-1
libblobmsg-json - 2015-03-22-b8d9b382e39823850331edc2a92379173daf1be3
libc - 0.9.33.2-1
libgcc - 4.8-linaro-1
libip4tc - 1.4.21-1
libip6tc - 1.4.21-1
libiwinfo - 2015-03-23-40f2844fadc05f4a4de7699dbc12fee295b7057b
libiwinfo-lua - 2015-03-23-40f2844fadc05f4a4de7699dbc12fee295b7057b
libjson-c - 0.12-1
libjson-script - 2015-03-22-b8d9b382e39823850331edc2a92379173daf1be3
liblua - 5.1.5-1
libnl-tiny - 0.1-4
libubox - 2015-03-22-b8d9b382e39823850331edc2a92379173daf1be3
libubus - 2015-01-22-2d660c519d2fcff95248da9f4fd9b37d61f9eb09
libubus-lua - 2015-01-22-2d660c519d2fcff95248da9f4fd9b37d61f9eb09
libuci - 2015-04-09.1-1
libuci-lua - 2015-04-09.1-1
libxtables - 1.4.21-1
lua - 5.1.5-1
luci - git-15.107.38351-ec09e99-1
luci-app-firewall - git-15.107.38351-ec09e99-1
luci-base - git-15.107.38351-ec09e99-1
luci-lib-ip - git-15.107.38351-ec09e99-1
luci-lib-nixio - git-15.107.38351-ec09e99-1
luci-mod-admin-full - git-15.107.38351-ec09e99-1
luci-proto-ppp - git-15.107.38351-ec09e99-1
luci-proto-relay - git-15.107.38351-ec09e99-1
luci-theme-bootstrap - git-15.107.38351-ec09e99-1
mtd - 20
netifd - 2015-04-17-944f30d3f96577464545dd35691f96b06fbcc6ab
odhcp6c - 2015-04-17-cc1ecd2c994d5cdf31b8184d87f8849b20b0c37c
odhcpd - 2015-04-14-33858d341fa7eff6e7245a2486fc42aee64c81ff
opkg - 9c97d5ecd795709c8584e972bfdf3aee3a5b846d-7
ppp - 2.4.7-5
ppp-mod-pppoe - 2.4.7-5
procd - 2015-04-10-27159f21f76b973a9fa3ec92b8fee2e390d43a43
relayd - 2015-03-13-2970ff60bac6b70ecb682779d5c776dc559dc0b9
rpcd - 2015-04-14-9a6bfa110a5f8caa10951921b63bafdbb6e97d33
swconfig - 10
uboot-envtools - 2014.10-2
ubox - 2015-04-02-6fbafd7d5b2835d00eb9d1684e7c6ccf907177b8
ubus - 2015-01-22-2d660c519d2fcff95248da9f4fd9b37d61f9eb09
ubusd - 2015-01-22-2d660c519d2fcff95248da9f4fd9b37d61f9eb09
uci - 2015-04-09.1-1
uhttpd - 2015-03-30-b9178b9357798ae23a5724333cc6572d14f23958
uhttpd-mod-ubus - 2015-03-30-b9178b9357798ae23a5724333cc6572d14f23958
wpad-mini - 2015-03-25-1

My hope is the kmod-input-polldev !

I think the gpio settings are identically for C5 and C7, i have read anywhere in the www that the wireless slider isn't working also for C5.

Supplement:
With Module kmod-input-polldev all buttons and Switches are working fine !!
:cool wink wink

(Last edited by Rampler on 19 Apr 2015, 18:15)

You are sending the patch to openwrt?

Rampler wrote:

I think the gpio settings are identically for C5 and C7, i have read anywhere in the www that the wireless slider isn't working also for C5.
...
You are sending the patch to openwrt?

I first would like to make sure it really doesnt break others (Archer-C5, Archer-C7 v1), so i hope someone with that models step over this topic smile
Then yes...

Archer C7 v1 report:

The wireless switch seems to work with default trunk.
So the patch would break v1.

Only has its logic inverted:Wireless Off enables the radio

I could export the 23 gpio with direction "in" (because its an input and not an led i think) but I observed no change there when I toggled between states.

(Last edited by zloop on 23 Apr 2015, 11:34)

zloop wrote:

Archer C7 v1 report:
The wireless switch seems to work with default trunk.
So the patch would break v1.

Hello zloop,

thanks for your test - now its getting a bit more complicated, but it surely cant be used as-is.

So currently i know:
Archer C7 v1: trunk working, patch would break it
Archer C7 v2: patch working
Archer C5 v1.20: patch working

Anyone using one of the WDR7500 models?

I applied the patch to the 15.05 branch r46751 and I noticed that at boot time, regardless of the switch position, wifi is always turned on.
After boot, the first change in position is always interpreted as "pressed" and wifi is turned off. A subsequent change in position results in "released" and wifi is turned back on. No custom hotplug scripts are necessary for this, it works out-of-the-box.

So the logic is not "inverted", it's just that the initial position is ignored.
I'm not sure how this works on V1 but I suspect it's the same.

The discussion might have continued from here.