Solved: Archer C7 Wifi button

Report problems and success stories with Gargoyle on various hardware platforms.

Moderator: Moderators

Adamon
Posts: 20
Joined: Tue Sep 06, 2016 5:17 am

Re: Archer C7 Wifi button

Post by Adamon »

Lantis wrote:I'll do a build with a relevant patch and see how we go.
Thanks a million!

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

Re: Archer C7 Wifi button

Post by Lantis »

images are available from here:
http://lantisproject.com/gargoyle_custom/TestPolldev

These have kmod-input-polldev preinstalled
and the GPIO mod already done.
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.

Adamon
Posts: 20
Joined: Tue Sep 06, 2016 5:17 am

Re: Archer C7 Wifi button

Post by Adamon »

Hello Lantis,
as mentioned earlier I have an Archer C5 (V 1.2) flashed with a C7 image. The sysupgrade does not work out of the box due to wrong HW ID. Couple of questions before I can proceed:
1) which image (factory or sysupgrade) should I use
2) can I use sysupgrade -vF to make it happen?
3) are there any differences between the images for C5 Verion 1.2 and C7 Version 2.0?
4) In case of "no" to 2), how can I test your new image?

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

Re: Archer C7 Wifi button

Post by Lantis »

I'm not equipped to answer any of those questions lol. I don't want to give you bad advice.
I can generate the v2 firmware but it will take time again.
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.

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

Re: Archer C7 Wifi button

Post by Lantis »

images available at the same link.
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.

Adamon
Posts: 20
Joined: Tue Sep 06, 2016 5:17 am

Re: Archer C7 Wifi button

Post by Adamon »

Hello Lantis,
I have tried both images, with and without preservation of settings. In none of the cases did the switch turn on/off the Wifi nor its corresponding LEDs. Only the last line in

Code: Select all

cat /sys/kernel/debug/gpio
GPIOs 0-23, ath79:
 gpio-12  (tp-link:blue:wlan2g ) out 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    
 gpio-23  (RFKILL switch       ) in  hi
changed to

Code: Select all

cat /sys/kernel/debug/gpio
GPIOs 0-23, ath79:
 gpio-12  (tp-link:blue:wlan2g ) out 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    
 gpio-23  (RFKILL switch       ) in  lo 
Do you have any explanation?

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

Re: Archer C7 Wifi button

Post by Lantis »

Can you please make the modification to the button handler file and then check that an event is logged when moving the switch?
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.

Adamon
Posts: 20
Joined: Tue Sep 06, 2016 5:17 am

Re: Archer C7 Wifi button

Post by Adamon »

It seems to be working at a first glance:

Code: Select all

logread -f
Mon Sep 12 07:38:14 2016 user.notice root: the button was rfkill and the action was pressed
Mon Sep 12 07:38:24 2016 user.notice root: the button was rfkill and the action was released
But when I logread and then connect a wifi device, a connection of this device is recorded irrespective of the setting of the switch, i.e. with button "pressed" and "realeased".

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

Re: Archer C7 Wifi button

Post by Lantis »

That is expected at this stage.
So to recap:
1. We have adjusted the button internal register to match its true external GPIO pin (from 13->23)
1.5. We added the polldev input kernel module which appears to be required for this device.
2. We have verified that the system now recognises that a movement of the switch is an event, and is capable of acting on it.
3. We now need to instruct the system on how to act when this event occurs.

So lets take care of part 3.
Now normally we are only dealing with a single button, so the pressed and released actions happen almost immediately. In your case we are dealing with a sliding switch so the actions happen separately. This means we can just tie different events to different actions instead of having to create a complicated handler script.

In your /etc/config/system file you need to add the following entry

Code: Select all

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'
At this point you can probably just run "/etc/init.d/system restart" to reload the system config and setup the button, but if that doesn't work, reboot the router.
The result should be that sliding the switch one way turns the wifi off, and the other way turns it on.

Note that if you turn off the router with the switch in a certain position, it will reset that position as the default "released" state. I don't think we can work around this issue.

Please let me know how this goes. This should be the resolution.
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.

Adamon
Posts: 20
Joined: Tue Sep 06, 2016 5:17 am

Re: Archer C7 Wifi button

Post by Adamon »

Perfect. Everything works as it should, including the corresponding LEDs turning on/off as required.

Thank you very much.

Post Reply