1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 16:13:10 +02:00
openwrt-xburst/package/comgt/files/3g.button

37 lines
740 B
Plaintext
Raw Normal View History

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)
} &