add proper uci/hotplug based button handling on atheros and work around boards, where...
[openwrt/svn-archive/archive.git] / target / linux / atheros / base-files / etc / hotplug.d / button / 00-button
1 . /etc/functions.sh
2 do_button () {
3 local button
4 local action
5 local handler
6 local min
7 local max
8
9 config_get button $1 button
10 config_get action $1 action
11 config_get handler $1 handler
12 config_get min $1 min
13 config_get max $1 max
14
15 [ "$ACTION" = "$action" -a "$BUTTON" = "$button" -a -n "$handler" ] && {
16 [ -z "$min" -o -z "$max" ] && eval $handler
17 [ -n "$min" -a -n "$max" ] && {
18 [ $min -le $SEEN -a $max -ge $SEEN ] && eval $handler
19 }
20 }
21 }
22
23 config_load system
24 config_foreach do_button button