Originally Posted by
Martin1802
I have some ideas for a custom version of oleg's or original ASUS firmware ...
* ...
- I want to have the keypress of button press modified ... to have easy access to some basic functions ...
* switch WLAN on / off (short button press toggles wlan)
* shutdown device (press button 5 sec.)
* reboot device (press button longer than 15 sec.)
* restore factory setting (press button on power on only!)
... this will be only possible examples for the new function of that button :-)
--------------------------
I change button keypress in Oleg's firmware 1.9.2.7-3 (file rc/watchdog.c) with some other functionality:
- reboot 3 sec, power led flashs shortly
- power down 5 sec, power led flashs longly
- reset to factory settings 15 sec, power led flashs too longly
- and super feathure - short press (0.25-2 sec) watchdog counting short keypresses, power led flashs too quickly, and than run script
Code:
/usr/local/sbin/button-pressed <count>
where <count> - counts of press, and you can change button processing at any time and add any counts of functions ;
I write in script on one press WLAN ON/OFF:
Code:
/usr/local/sbin/button-pressed
#!/bin/sh
buttonlog() {
echo "`date`: $1" >> /tmp/button.log
}
wlupdown() {
CHECK=`wl isup 2>&1| grep on`
if [ -z "$CHECK" ]; then
insmod wl && wl up && buttonlog "WiFi started up"
else
rmmod wl && buttonlog "WiFi shutdowned"
fi
}
buttonlog "Button pressed count $1"
case "$1" in
1)
wlupdown;;
*)
buttonlog "No handlers for count $1";;
esac
und if you want to WLAN OFF on boot - write in /usr/local/sbin/post-boot script