From: Felix Fietkau Date: Fri, 3 Nov 2006 10:26:38 +0000 (+0000) Subject: add full button and led support for the wrt54g3g, pressing the 3g button will run... X-Git-Tag: whiterussian_rc6~20 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=dd77633dd08fb7cc88672f8f1e23f0da354e9041;p=openwrt%2Fsvn-archive%2Fopenwrt.git add full button and led support for the wrt54g3g, pressing the 3g button will run ifdown wan; ifup wwan. pressing it again later will do the reverse, the led will indicate the state changes (initializing card -> card init done -> connecting to provide -> ip connection established) SVN-Revision: 5414 --- diff --git a/openwrt/package/comgt/Makefile b/openwrt/package/comgt/Makefile index 793cad7f3c..3f10f5c846 100644 --- a/openwrt/package/comgt/Makefile +++ b/openwrt/package/comgt/Makefile @@ -31,6 +31,8 @@ $(PKG_BUILD_DIR)/.built: $(IPKG_COMGT): install -d -m0755 $(IDIR_COMGT)/usr/bin install -m0755 $(PKG_BUILD_DIR)/gcom $(IDIR_COMGT)/usr/bin/ + install -d -m0755 $(IDIR_COMGT)/etc/ppp + install -m0755 ./files/wwan.connect $(IDIR_COMGT)/etc/ppp/wwan.connect install -d -m0755 $(IDIR_COMGT)/etc/chatscripts install -m0644 ./files/wwan.chat $(IDIR_COMGT)/etc/chatscripts/wwan.chat install -d -m0755 $(IDIR_COMGT)/etc/gcom @@ -40,6 +42,11 @@ $(IPKG_COMGT): install -m0644 ./files/getstrength.gcom $(IDIR_COMGT)/etc/gcom/getstrength.gcom install -d -m0755 $(IDIR_COMGT)/sbin install -m0755 ./files/ifup.wwan $(IDIR_COMGT)/sbin/ + install -m0755 ./files/ifdown.wwan $(IDIR_COMGT)/sbin/ + install -d -m0755 $(IDIR_COMGT)/etc/hotplug.d/iface + install -m0644 ./files/wwan.iface $(IDIR_COMGT)/etc/hotplug.d/iface/05-wwan + install -d -m0755 $(IDIR_COMGT)/etc/hotplug.d/button + install -m0644 ./files/wwan.button $(IDIR_COMGT)/etc/hotplug.d/button/01-wwan $(RSTRIP) $(IDIR_COMGT) $(IPKG_BUILD) $(IDIR_COMGT) $(PACKAGE_DIR) diff --git a/openwrt/package/comgt/files/ifdown.wwan b/openwrt/package/comgt/files/ifdown.wwan new file mode 100644 index 0000000000..dc671652b4 --- /dev/null +++ b/openwrt/package/comgt/files/ifdown.wwan @@ -0,0 +1,5 @@ +#!/bin/sh +echo 0 > /proc/diag/led/3g_green +echo 0 > /proc/diag/led/3g_blue +echo 0 > /proc/diag/led/3g_blink +killall pppd diff --git a/openwrt/package/comgt/files/ifup.wwan b/openwrt/package/comgt/files/ifup.wwan index b67da17538..c9ee11a78a 100644 --- a/openwrt/package/comgt/files/ifup.wwan +++ b/openwrt/package/comgt/files/ifup.wwan @@ -72,15 +72,18 @@ fi MTU=$(nvram get wwan_mtu) + echo 0 > /proc/diag/led/3g_blue + echo 1 > /proc/diag/led/3g_green + echo 1 > /proc/diag/led/3g_blink if PINCODE=$(nvram get wwan_pincode) gcom -d $wwan_device -s /etc/gcom/setpin.gcom; then MODE="$MODE" gcom -d $wwan_device -s /etc/gcom/setmode.gcom + echo 0 > /proc/diag/led/3g_blink /usr/sbin/pppd nodetach \ noaccomp \ nopcomp \ novj \ nobsdcomp \ noauth \ - connect /bin/true \ usepeerdns \ defaultroute \ replacedefaultroute \ @@ -93,7 +96,7 @@ fi $KEEPALIVE \ lock \ crtscts \ - connect "WWAN_APN=\"$APN\" /usr/sbin/chat -V -E -f /etc/chatscripts/wwan.chat" \ + connect "WWAN_APN=\"$APN\" /etc/ppp/wwan.connect" \ 460800 "$wwan_device" else echo "Wrong Pincode." diff --git a/openwrt/package/comgt/files/wwan.button b/openwrt/package/comgt/files/wwan.button new file mode 100644 index 0000000000..904f0bba68 --- /dev/null +++ b/openwrt/package/comgt/files/wwan.button @@ -0,0 +1,18 @@ +[ "$ACTION" = "released" -a "$BUTTON" = "3g" ] && { + (echo /bin/true > /proc/sys/kernel/hotplug) + + # use led for keeping track of the state + case "$(cat /proc/diag/led/3g_green)" in + 1) + ifdown wwan + ifup wan + ;; + 0) + ifdown wan + ifup wwan + ;; + esac + sleep 1 + + (echo /sbin/hotplug > /proc/sys/kernel/hotplug) +} diff --git a/openwrt/package/comgt/files/wwan.connect b/openwrt/package/comgt/files/wwan.connect new file mode 100644 index 0000000000..d8ce6c53fd --- /dev/null +++ b/openwrt/package/comgt/files/wwan.connect @@ -0,0 +1,4 @@ +#!/bin/sh +echo 1 > /proc/diag/led/3g_blue +echo 1 > /proc/diag/led/3g_blink +/usr/sbin/chat -V -E -f /etc/chatscripts/wwan.chat diff --git a/openwrt/package/comgt/files/wwan.iface b/openwrt/package/comgt/files/wwan.iface new file mode 100644 index 0000000000..fe3663e0ce --- /dev/null +++ b/openwrt/package/comgt/files/wwan.iface @@ -0,0 +1,12 @@ +[ "$INTERFACE" = "wwan" ] && { + case "$ACTION" in + ifup) + echo 0 > /proc/diag/led/3g_blink + ;; + ifdown) + echo 0 > /proc/diag/led/3g_blue + echo 0 > /proc/diag/led/3g_green + echo 0 > /proc/diag/led/3g_blink + ;; + esac +}