Button Script For MBox (and clones)
The OpenWRT port for the MBox has the hotplug package installed by default.
This package can provide for button control by simple scripts in the /etc/hotplug.d/button/
follder.
In this folder there is already a script called 01-button (with commented out lines).
Replace the contents of this script with the code below, to set the upper button for a
firmware shutdown and the lower button for a system reboot
Code:
#!/bin/sh
if [ "$BUTTON" = "BTN_0" ] && [ "$ACTION" = "released" ] && [ $SEEN -gt "5" ] ; then
exec kill -USR1 1
fi
if [ "$BUTTON" = "BTN_1" ] && [ "$ACTION" = "released" ] && [ $SEEN -gt "5" ] ; then
reboot
fi
End Code:
There is more information on the OpenWRT site (
http://wiki.openwrt.org/doc/howto/hardware.button), including a script called
"Atheros' 00-button + UCI" that integrates button control into the UCI system. This script works fine on the MBox.
Aquar