diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-27 20:29:00 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-27 20:29:00 +0000 |
commit | d495281b6e84679549b0bee40b847642772a09bd (patch) | |
tree | f383eb0f8fae0af60b7efbb4a5f72ae14298aa70 /package/comgt/files-old/3g.button | |
parent | 2af4d0433626b5f4e69f66117402afcf2cd09816 (diff) | |
download | upstream-d495281b6e84679549b0bee40b847642772a09bd.tar.gz upstream-d495281b6e84679549b0bee40b847642772a09bd.tar.bz2 upstream-d495281b6e84679549b0bee40b847642772a09bd.zip |
comgt: port 3g.sh to netifd
SVN-Revision: 28634
Diffstat (limited to 'package/comgt/files-old/3g.button')
-rw-r--r-- | package/comgt/files-old/3g.button | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/package/comgt/files-old/3g.button b/package/comgt/files-old/3g.button new file mode 100644 index 0000000000..57f4286073 --- /dev/null +++ b/package/comgt/files-old/3g.button @@ -0,0 +1,36 @@ +button_action() {( + # use led for keeping track of the state + case "$(cat /proc/diag/led/3g_green)" in + 1) + ifdown "$1" + ifup wan + ;; + 0) + ifdown wan + ifup "$1" + ;; + esac +)} + +[ "$ACTION" = "released" -a "$BUTTON" = "3g" ] && { + HOTPLUG="$(cat /proc/sys/kernel/hotplug)" + (echo /bin/true > /proc/sys/kernel/hotplug) + + include /lib/network + scan_interfaces + config_cb() { + config_get TYPE "$CONFIG_SECTION" TYPE + case "$TYPE" in + interface) + config_get proto "$CONFIG_SECTION" proto + config_get button "$CONFIG_SECTION" button + case "$button" in + 1|on|enabled) [ "$proto" = "3g" ] && button_action "$CONFIG_SECTION";; + esac + ;; + esac + } + config_load network + + (echo $HOTPLUG > /proc/sys/kernel/hotplug) +} & |