Wifi on/off switch Archer C7?

Suggest improvements and new features for Gargoyle.

Moderator: Moderators

Adamon1
Posts: 9
Joined: Fri Jun 15, 2018 6:54 am

Wifi on/off switch Archer C7?

Post by Adamon1 »

Hello,
the previous version 1.9.2 contained a change to enable the hardware wifi on/off switch (add 'phpbb/viewtopic.php?f=8&t=9118&start=20' to the gargyole-router web address to see, I can't post urls :?: ).
From what I can see, the neccessary kernel module is also provided in the latest gargoyle firmware

Code: Select all

opkg list-installed |grep polldev
kmod-input-polldev - 3.18.75-1-85ebbd687615e332b5e1d1c2b6f80fc0
I tried to repeat the steps mentioned in the a.m. thread, i.e.
  • echo 23 > export
    echo in > gpio23/direction
    made the changes to the gargoyle_button_handler
    made the changes to /etc/config/system, restarted/rebooted
to no avail. Am I doing something wrong or has this feature been removed?

Adamon

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

Re: Wifi on/off switch Archer C7?

Post by Lantis »

Can you please follow the steps 1 and by 1 and tell me where you get stuck? There's a lot that needs to happen to get it to work.
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.

Adamon1
Posts: 9
Joined: Fri Jun 15, 2018 6:54 am

Re: Wifi on/off switch Archer C7?

Post by Adamon1 »

Hello Lantis,
I will reply to you tomorrow. I am facing nightmares when reloading configs, resulting in all ethernet ports being inaccessible.

Just got the router back on line, I am too exhausted to properly reply.

Hope you are still around tomorrow :roll:

Cheers,
Adamon

Adamon1
Posts: 9
Joined: Fri Jun 15, 2018 6:54 am

Re: Wifi on/off switch Archer C7?

Post by Adamon1 »

Back again. Here is what I did:

Code: Select all

opkg list-installed |grep polldev
kmod-input-polldev - 3.18.75-1-85ebbd687615e332b5e1d1c2b6f80fc0

Code: Select all

switch is linked to gpio-13:
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-22  (USB1 power          ) out h

Code: Select all

assigning switch to gpio-23, testing on/off
root@Gargoyle:~# cd /sys/class/gpio/
root@Gargoyle:/sys/class/gpio# echo 23 > export
root@Gargoyle:/sys/class/gpio# echo in > gpio23/direction
root@Gargoyle:/sys/class/gpio# cat gpio23/value
0
root@Gargoyle:/sys/class/gpio# cat gpio23/value
1

Code: Select all

replaced the gargoyle_button_handler with the script from Lantis (amend "logger the button was $BUTTON and the action was $ACTION") in /etc/rc.button/gargoyle_button_handler

Code: Select all

checked whether rfkill is linked to the gargoyle_button_handler
ls -l /etc/rc.button/
lrwxrwxrwx 1 root   root  23 Oct 25  2017 failsafe -> gargoyle_button_handler
-rwxr-xr-x 1 root   root 528 Jun 19 09:54 gargoyle_button_handler
lrwxrwxrwx 1 root   root  23 Oct 25  2017 power -> gargoyle_button_handler
lrwxrwxrwx 1 root   root  23 Oct 25  2017 reset -> gargoyle_button_handler
lrwxrwxrwx 1 root   root  23 Oct 25  2017 rfkill -> gargoyle_button_handler
lrwxrwxrwx 1 root   root  23 Oct 25  2017 wps -> gargoyle_button_handler

Code: Select all

amended /etc/config/system by
config button 'wifi_on'
   option button 'rfkill'
   option action 'pressed'
   option handler 'wifi up'

config button 'wifi_off'
   option button 'rfkill'
   option action 'released'
   option handler 'wifi down

Code: Select all

rebooted 
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
During these steps I did logreads, but no event was ever recorded upon switching the slider.

It seems that the assignment to gpio-23 is getting lost during reboot, so the system file and the gargoyle_button_handler loose their targets. Therefore tried again, but ran /etc/init.d/system restart instead of booting...no difference

Did I miss a step?

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

Re: Wifi on/off switch Archer C7?

Post by Lantis »

Reading through the last thread, it looks like the only success you had was when i performed the GPIO mod for you in a precompiled image. Perhaps it will not allow you to change it if it already exists? I expect the problem becomes needing to move the rfkill reference from 13 to 23, but i do not know how to do it.

The modification for the precompiled image is quite simple, and is the way i would recommend to do it.

Alternatively, it will be already fixed in version 1.11.x (of which there are some betas available)
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.

Adamon1
Posts: 9
Joined: Fri Jun 15, 2018 6:54 am

Re: Wifi on/off switch Archer C7?

Post by Adamon1 »

The modification for the precompiled image is quite simple, and is the way i would recommend to do it.
Do you have a howto at hand? I would be willing to dig into this.
version 1.11.x (of which there are some betas available)
where can they be found? Checked /ericpaulbishop/gargoyle.git on github.com, did not see any :cry:
Adamon

Adamon1
Posts: 9
Joined: Fri Jun 15, 2018 6:54 am

Re: Wifi on/off switch Archer C7?

Post by Adamon1 »

Hold on ....
just noticed

Code: Select all

ls -l /etc/rc.button/
-rw-r--r--  1 root  root   625 Jun 19 10:30 gargoyle_button_handler
the execution bit was missing (I edited the file remotely and copied it back :roll: ). Added "x" back.

Still no logread output when sliding the switch. No difference therefore.

ispyisail
Moderator
Posts: 5180
Joined: Mon Apr 06, 2009 3:15 am
Location: New Zealand

Re: Wifi on/off switch Archer C7?

Post by ispyisail »


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

Re: Wifi on/off switch Archer C7?

Post by Lantis »

So you need to compile 1.10.x from source, and add a new patch to “patches-generic” which modifies the file at target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c7.c

Line 53 needs to change from 13 to 23

That should be all that is required.
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.

Adamon1
Posts: 9
Joined: Fri Jun 15, 2018 6:54 am

Re: Wifi on/off switch Archer C7?

Post by Adamon1 »

All right, cheers mates. So I have to wait for the (hopefully coming soon) version 1.11.0.

I am not familiar with the terminology, and a thorough read of the wiki for developers page and some other forum entries convinced me that I do not understand anything and should keep me fingers off trying to mess around with the router firmware.

Adamon

Post Reply