Wifitoggle runs twice: how to fix?

Hello, following up the hints in this thread How to turn radios off completely? - #4 by AndrewZ, I'm trying to set up Wi-Fi toggle on a toggle button. Here's my configuration:

# uci show wifitoggle
wifitoggle.@wifitoggle[0]=wifitoggle
wifitoggle.@wifitoggle[0].button='wlan'
wifitoggle.@wifitoggle[0].persistent='0'
wifitoggle.@wifitoggle[0].timer='0'
wifitoggle.@wifitoggle[0].led_enable_trigger='timer'
wifitoggle.@wifitoggle[0].led_enable_delayon='500'
wifitoggle.@wifitoggle[0].led_enable_delayoff='500'
wifitoggle.@wifitoggle[0].led_disable_default='0'

The problem with that approach is that the script 50-wifitoggle dropped in /etc/hotplug.d/button is run twice: one time for button press, another one for button release. Is there a way to fix it?

Make sure that only the “pressed” action is specified.

See this:

2 Likes

Hi, I've just checked but there is no defined button in system.

There are two things you could try.

  • add action = pressed to the existing config
    Or
  • remove this config and use the method shown in the example
2 Likes

Hi. Unfortunately I can't use the method shown here https://openwrt.org/docs/guide-user/hardware/hardware.button#examples since I can't install kmod-button-hotplug (i.e,. "Packages for kmod-button-hotplug found, but incompatible with the architectures configured")

I need to stick to a script in /etc/hotplug.d/button or to something similar to the following one:

That seems odd. What is the output of:

ubus call system board 
1 Like

Here's the output:

{
	"kernel": "5.15.114",
	"hostname": "OpenWrt",
	"system": "ARMv8 Processor rev 4",
	"model": "Zyxel EX5601-T0",
	"board_name": "zyxel,ex5601-t0",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "SNAPSHOT",
		"revision": "r23300-86bc525d00",
		"target": "mediatek/filogic",
		"description": "OpenWrt SNAPSHOT r23300-86bc525d00"
	}
}

In my current situation, all scripts in /etc/hotplug.d/button are executed upon button press. On the contrary, scripts in /etc/rc.button/ seem not executed.

Consider installing a stable release version (well, almost - an rc).

https://firmware-selector.openwrt.org/?version=23.05.0-rc3&target=mediatek%2Ffilogic&id=zyxel_ex5601-t0-stock

This may work better and won’t have issues with user installed packages.

2 Likes