Modifying reset button action (SOLVED)

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

Post Reply
User avatar
harsini
Posts: 84
Joined: Mon Jul 22, 2013 9:59 am
Location: Iran

Modifying reset button action (SOLVED)

Post 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 4740 times
but I also have no success with v7 which have separate button.
DSC_0034.jpg
DSC_0034.jpg (73.6 KiB) Viewed 4740 times
Would changing /etc/config/system file change the reset button action or not?
Last edited by harsini on Fri May 15, 2015 12:50 am, edited 1 time in total.

Lantis
Moderator
Posts: 7153
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia
Contact:

Re: Modifying reset button action

Post by Lantis »

/etc/hotplug.d/button/
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.
https://lantisproject.com/blog

User avatar
harsini
Posts: 84
Joined: Mon Jul 22, 2013 9:59 am
Location: Iran

Re: Modifying reset button action

Post 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.

Lantis
Moderator
Posts: 7153
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia
Contact:

Re: Modifying reset button action

Post by Lantis »

There's also a config in rc.button
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.
https://lantisproject.com/blog

User avatar
harsini
Posts: 84
Joined: Mon Jul 22, 2013 9:59 am
Location: Iran

Re: Modifying reset button action

Post 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?

Post Reply