OpenWrt Forum Archive

Topic: Problem with customized reset button at boot on TP-Link

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

Hello everybody,
I have a TP-Link TL-WA901N/ND v3 running openWrt that works like a charm.
I also customized the behaviour of reset button (the only button on this device so the only input available), connecting a circuit to it that sometimes simulates button pressing and runs a small script. Also this part is working properly.

The problem is when the TP-link reboots (or simply power is unplugged and plugged again). if the circuit is closed at boot (so reset pressed) on the first half second of boot (when all the leds are lighting up for a moment), openwrt probably boots in a weird way, that is not a failsafe mode, nor a software reset or anything else:
it just boot properly and keeps all my configuration, but wifi is kind of dead (even if configured).

There is no way to turn it on: luci says "wifi disconnected or disabled", all the configuration is still there, but if i try to press every enable or restart wifi button it never works. if i try from ssh it tells me "phy for wifi device radio0 not found"; looks like it doesn't see the wifi device anymore.

At this point there's no way to restore wifi, neither rebooting it several times without reset pressed, nor anything else. the only things to restore it is erase openwrt configuration to default, then load again my saved configuration.

The even more weird thing is that this happens only whether the file /etc/hotplug.d/button/buttons exists. Before creating it, I don't get any issue at boot even if i press reset button. Tried several time to reproduce the issue, the content of the file doesn't matter, when the file is there, openwrt is going to kill wifi at restart.

To configure the button I followed this guide:  wiki. openwrt. org /doc/howto/hardware . button
at first with the logger test, then using the long script posted inside and then using the "uci" commands, at the end I simply used the following script without any uci command. the result is the same: wifi dead if it reboots with reset pressed.

#!/bin/sh
if [ "$ACTION" = "pressed" ]
then
     <run script>
fi


I also tried putting the file in /tmp and creating a soft link in /etc/hotplug.d/button/buttons but the problem persists.

I already control activation of the circuit through a LED output, but the fact that at boot all the leds turn on for a while is a problem.

I also thought about adding to the external circuit an RC component to delay the circuit startup, so that the circuit need some time to get powered and doesn't close the reset button on the first half second, but this is not suitable because if power supply is toggled for a fraction of second the C could not be fully discarghed and power the circuit too fast.

I don't know what else to do... do you have any idea on why this wifi corruption?

thank you very much

Hi everybody,
after some further testing I found out that the problem (wifi dead) happens when the device is powered OFF with reset button pressed (and not powered ON with reset button pressed as I supposed earlier).

So there's also no way to predict a power lack and release the button in advance.

Really weird. Happens only if the file /etc/hotplug.d/button/buttons exists, otherwise everything is ok.

Any suggestion is appreciated.

Thank you again

The discussion might have continued from here.