====== Router Button Functions ======
Just about all routers have different hardware configurations so this how-to is to help end users **find** and **test** router push buttons.
===== Make Router Connection =====
You will need:
PuTTY.exe (or your favourite SSH client)
WinSCP
log into your router with both of these programs, the defaults are:
* hostname: 192.168.1.1
* port: 22
* username: root
* password: yourpassword
In WinSCP make sure you set File Protocol to **SCP** (Not "SFTP" as is the default) , and also tell it to remember your password for the session or you will be typing it over and over.
===== Find Button Name =====
Open //gargoyle_button_handler// file to edit and add a line of code to find button name
/etc/rc.button/gargoyle_button_handler
add the following line
logger the button was $BUTTON and the action was $ACTION
as shown below
[ "$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
}
i.e. make sure it goes between the 2nd last and last braces.
Save and close
===== Test For Button Name =====
Go and press the button on your router that you wish to have as your wifi toggle button.
in PuTTY, type
logread
look for the following phrase
Wed May 1 19:23:39 2019 user.notice root: the button was wps and the action was pressed
Write this button name down exactly as stated, we will need it soon.
In the example above the TP-Link C7 v2 button is "wps" with action "pressed"
===== Edit and Test Function =====
Open Config File
/etc/config/system
..
config button 'reset_button'
option button 'New_Button_Name'
option action 'released'
option handler 'logger restore defaults ; /sbin/firstboot -y; reboot ;'
option min '3'
option max '90'
..
change 'reset' to 'New_Button_Name'
you’ll also need a symlink from that button to the Gargoyle button handler like the other buttons
ln -s /etc/rc.button/gargoyle_button_handler /etc/rc.button/New_Button_Name
Where //New_Button_Name// is your new found button name.