Page 1 of 1

Modifying reset button action (SOLVED)

Posted: Thu May 14, 2015 1:46 am
by harsini
Hi.I was about disabling reset button of wr841.I saw some topics about disabling reset or others router buttons.But I have no success with modifying /etc/config/system file in WR841nd and WR741nd.
I completely remove reset button config and also changed max/min values but non of them disabled or change the reset button action.
At first I thought the problem would be new button config of 841nd v9 which the wps and reset button integrated:
TL-WR841ND_8.0-04_1_.jpg
TL-WR841ND_8.0-04_1_.jpg (80.52 KiB) Viewed 4739 times
but I also have no success with v7 which have separate button.
DSC_0034.jpg
DSC_0034.jpg (73.6 KiB) Viewed 4739 times
Would changing /etc/config/system file change the reset button action or not?

Re: Modifying reset button action

Posted: Thu May 14, 2015 2:48 am
by Lantis
/etc/hotplug.d/button/

Re: Modifying reset button action

Posted: Thu May 14, 2015 3:05 am
by harsini
Lantis wrote:/etc/hotplug.d/button/
I have a file named 00-buton there and its codes seems to be fine: :roll:

Code: Select all

. /etc/functions.sh
do_button () {
        local button
        local action
        local handler
        local min
        local max

        config_get button $1 button
        config_get action $1 action
        config_get handler $1 handler
        config_get min $1 min
        config_get max $1 max

        [ "$ACTION" = "$action" -a "$BUTTON" = "$button" -a -n "$handler" ] && {
                [ -z "$min" -o -z "$max" ] && eval $handler
                [ -n "$min" -a -n "$max" ] && {
                        [ $min -le $SEEN -a $max -ge $SEEN ] && eval $handler
                }
        }
}
reset button config in /etc/config/system:

Code: Select all

config button 'reset_button'
        option button 'reset'
        option action 'released'
        option handler 'logger restore defaults ; /sbin/firstboot ; reboot ;'
        option min '3'
        option max '90'
Once I removed whole button config,once I changed main/max to a large number but non of them works.

Re: Modifying reset button action

Posted: Thu May 14, 2015 4:08 am
by Lantis
There's also a config in rc.button

Re: Modifying reset button action

Posted: Fri May 15, 2015 12:17 am
by harsini
Lantis wrote:There's also a config in rc.button
Thank you that works for me.

Code: Select all

#!/bin/sh

[ "${ACTION}" = "released" ] || exit 0

. /lib/functions.sh

logger "$BUTTON pressed for $SEEN seconds"

if [ "$SEEN" -lt 1 ]
then
	echo "REBOOT" > /dev/console
	sync
	reboot
elif [ "$SEEN" -gt 5 ]
then
	echo "FACTORY RESET" > /dev/console
	jffs2reset -y && reboot &
fi
Do you know where can I change SEEN var?where is it defined?