OpenWrt Forum Archive

Topic: Disable WiFi Toggle on Router

The content of this topic has been archived on 5 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello!

Is there a way to disable the physical WiFi toggle on the router via an OpenWRT command?

I install hotspots and many times I get called just because my client accidentally pressed the damn button ;-)

The router's model is TL-WR841ND.

Thank you,
Guido

You'll find some instructions related to this feature from https://wiki.openwrt.org/toh/tp-link/tl … qss_button

It is not a guide on how to disable it, but it should help you in identifying the script that is executed when the button is pressed. By detaching the script from the button press, you essentially disable the feature.

You might want to leave the "On" part enabled, though so that in case the wireless network is off, it can be switched on by pressing the button, instead of requiring an SSH or LuCI access to the router.

Thanks Antek, the resource you linked is very helpful.
I also found an interesting answer on the topic on Unix StackExchange => unix.stackexchange.com/a/271991/41613

In the end I managed to disable the WiFi button by creating a file /etc/hotplug.d/button/50-wifiswitch with this code inside:

#/bin/sh
if [ "$BUTTON" = "rfkill" ] ; then
  if [ "$ACTION" = "released" ] ; then
    logger "Ignoring disable wifi (rfkill button released)"
    uci set 'wireless.@wifi-device[0].disabled=0'
  elif [ "$ACTION" = "pressed" ] ; then
    logger "Enabling wifi (rfkill button pressed)"
    uci set 'wireless.@wifi-device[0].disabled=0'
  else
    logger "Unknown action: $ACTION"
    exit 1
  fi
  wifi
fi

Hopefully this will help my clumsy clients ;-)

Note however this solution relies on hotplug, which as far as I understand is being phased out. Alas I don't know how to adapt it to procd.

Cheers,
Guido

It is possible that you can find a file in /etc/rc.button/ folder named "rfkill". This file contains a procd-compatible sh-script that is executed when the button is pressed or released.

It *should* work similar to the hotplug-button scripts....

Thank you Antek! I'll try what you suggest during the next hotspot installation, and report back to the forum :-)
Have a nice day,
Guido

The discussion might have continued from here.