rpcd: iwinfo plugin fixes
[openwrt/svn-archive/archive.git] / package / network / utils / comgt / files / 3g.sh
index 2ed74b4c0845d90ef4cbcd2366064ae35357b7d7..b0cdae234db8ed99d1de1842d956f096c1e54ab0 100644 (file)
@@ -1,18 +1,23 @@
 #!/bin/sh
-INCLUDE_ONLY=1
 
-. ../netifd-proto.sh
-. ./ppp.sh
-init_proto "$@"
+[ -n "$INCLUDE_ONLY" ] || {
+       NOT_INCLUDED=1
+       INCLUDE_ONLY=1
+
+       . ../netifd-proto.sh
+       . ./ppp.sh
+       init_proto "$@"
+}
 
 proto_3g_init_config() {
        no_device=1
        available=1
        ppp_generic_init_config
-       proto_config_add_string "device"
+       proto_config_add_string "device:device"
        proto_config_add_string "apn"
        proto_config_add_string "service"
        proto_config_add_string "pincode"
+       proto_config_add_string "dialnumber"
 }
 
 proto_3g_setup() {
@@ -23,7 +28,9 @@ proto_3g_setup() {
        json_get_var apn apn
        json_get_var service service
        json_get_var pincode pincode
+       json_get_var dialnumber dialnumber
 
+       [ -n "$dat_device" ] && device=$dat_device
        [ -e "$device" ] || {
                proto_set_available "$interface" 0
                return 1
@@ -74,16 +81,22 @@ proto_3g_setup() {
                        [ -n "$SIERRA" ] && {
                                gcom -d "$device" -s /etc/gcom/getcarrier.gcom || return 1
                        }
+
+                       if [ -z "$dialnumber" ]; then
+                               dialnumber="*99***1#"
+                       fi
+
                ;;
        esac
 
-       connect="${apn:+USE_APN=$apn }/usr/sbin/chat -t5 -v -E -f $chat"
+       connect="${apn:+USE_APN=$apn }DIALNUMBER=$dialnumber /usr/sbin/chat -t5 -v -E -f $chat"
        ppp_generic_setup "$interface" \
                noaccomp \
                nopcomp \
                novj \
                nobsdcomp \
                noauth \
+               set EXTENDPREFIX=1 \
                lock \
                crtscts \
                115200 "$device"
@@ -94,4 +107,4 @@ proto_3g_teardown() {
        proto_kill_command "$interface"
 }
 
-add_protocol 3g
+[ -z "NOT_INCLUDED" ] || add_protocol 3g