ar71xx: ag71xx: make switch register access atomic
[openwrt.git] / package / comgt / files / 3g.button
1 button_action() {(
2 # use led for keeping track of the state
3 case "$(cat /proc/diag/led/3g_green)" in
4 1)
5 ifdown "$1"
6 ifup wan
7 ;;
8 0)
9 ifdown wan
10 ifup "$1"
11 ;;
12 esac
13 )}
14
15 [ "$ACTION" = "released" -a "$BUTTON" = "3g" ] && {
16 HOTPLUG="$(cat /proc/sys/kernel/hotplug)"
17 (echo /bin/true > /proc/sys/kernel/hotplug)
18
19 include /lib/network
20 scan_interfaces
21 config_cb() {
22 config_get TYPE "$CONFIG_SECTION" TYPE
23 case "$TYPE" in
24 interface)
25 config_get proto "$CONFIG_SECTION" proto
26 config_get button "$CONFIG_SECTION" button
27 case "$button" in
28 1|on|enabled) [ "$proto" = "3g" ] && button_action "$CONFIG_SECTION";;
29 esac
30 ;;
31 esac
32 }
33 config_load network
34
35 (echo $HOTPLUG > /proc/sys/kernel/hotplug)
36 } &
This page took 0.041235 seconds and 5 git commands to generate.