Switch on GL-MT300N-V2 does not turn on WireGuard

I have the MT300N-V2 “mango” router. I have it configured to use the switch on the back to enable/disable WireGuard. It is not working correctly. It will stop WireGuard, but it will not start it back up. I have to start it from the web interface.

I did some poking around, and I think I have narrowed down where the bug is located. In the /usr/bin/switchaction script, on line 82, it tries to run this command to determine if the switch is left or right:

switch_left=$(grep -o "BTN_0.*hi" /sys/kernel/debug/gpio)

That always comes back as an empty string.

I am on firmware 3.212.

Any help would be greatly appreciated.

I do not see a change in /sys/kernel/debug/gpio before and after moving the switch. I get this either direction:

root@GL-MT300N-V2:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/10000600.gpio, 10000600.gpio:
 gpio-0   (                    |BTN_0               ) in  lo
 gpio-3   (                    |BTN_1               ) in  lo
 gpio-11  (                    |usb                 ) out hi

gpiochip1: GPIOs 32-63, parent: platform/10000600.gpio, 10000600.gpio:
 gpio-38  (                    |reset               ) in  hi
 gpio-42  (                    |gl-mt300n-v2:green:p) out lo
 gpio-43  (                    |gl-mt300n-v2:green:w) out hi
 gpio-44  (                    |gl-mt300n-v2:red:wla) out hi

I know the switchaction script is being executed when I flip the switch because I threw some debugging in there, so the switch itself seems functional.

The switch left is correct.


So it must be something else.

Tested on firmware 3.212

  1. Install Azirevpn
  2. Connect Azirevpn (must do this once to have a default Wireguard config)
  3. Set up the switch to control Wireguard
  4. Use switch to control wireguard: Left - enable, Right - disable

Works as expected.