Mittwoch, 10. September 2025, 22:25 UTC+2

Sie sind nicht angemeldet.

  • Anmelden
  • Registrieren

AQUAR

Schüler

Beiträge: 116

Wohnort: Australia

1

Mittwoch, 1. Februar 2012, 00:37

Button Script For MBox

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