[GL-MT300N-V2] custom function for reset button

Hi, I’d like to know if it’s possible to customize the reset button so that when pressed the wifi is toggled on or off.

You can modify the file “/etc/rc.button/reset” to achieve.

the reset button script is a little different. It acually has 3 functions to detect

  1. if buttton and is pressed and held for 3 seconds and then released it resets wifi
  2. if held for 8-19 sec, factory reset,
    3, if held for 20 or greater then reboot.

by editing /usr/bin/button_released you can change or probably add additional timed fuctions and change the timings on what you want executed. just make sure time checks go from 20 to next lower if adding new timings. I have not tried new timings but thought about it when respoding

I change wifi reset of 3 second press to poweroff below. you may want to play with factory reset and bump it from 8 to 10 and add your custom command to letes say 6 seconds.

directions below here are for just changing 3 sec wifi reset to poweroff.
I just slipped it in here and commented out 2 of the old commands in
/usr/bin/button_released at the bottom

if [ “$reset_pressed_duration” -gt 20 ]; then
echo ‘Reset action cancelled’ > /dev/console
/etc/init.d/led restart
elif [ “$reset_pressed_duration” -gt 8 ]; then
elif [ “$reset_pressed_duration” -gt 3 ]; then
#c reset_network
#c /etc/init.d/led restart