add full button and led support for the wrt54g3g, pressing the 3g button will run...
authorFelix Fietkau <nbd@openwrt.org>
Fri, 3 Nov 2006 10:26:38 +0000 (10:26 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 3 Nov 2006 10:26:38 +0000 (10:26 +0000)
SVN-Revision: 5414

openwrt/package/comgt/Makefile
openwrt/package/comgt/files/ifdown.wwan [new file with mode: 0644]
openwrt/package/comgt/files/ifup.wwan
openwrt/package/comgt/files/wwan.button [new file with mode: 0644]
openwrt/package/comgt/files/wwan.connect [new file with mode: 0644]
openwrt/package/comgt/files/wwan.iface [new file with mode: 0644]

index 793cad7f3c678c363c1fdb208c125bf5574e2250..3f10f5c846b88611cfe6db1a8037b281ea48b83f 100644 (file)
@@ -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 (file)
index 0000000..dc67165
--- /dev/null
@@ -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
index b67da17538ef12f6619f7d9b42e4f04a8ebf859c..c9ee11a78af1bfe7fc2425f47a28fc5f87c37b5d 100644 (file)
@@ -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 (file)
index 0000000..904f0bb
--- /dev/null
@@ -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 (file)
index 0000000..d8ce6c5
--- /dev/null
@@ -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 (file)
index 0000000..fe3663e
--- /dev/null
@@ -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
+}