8 proto_3g_init_config() {
11 ppp_generic_init_config
12 proto_config_add_string "device:device"
13 proto_config_add_string "apn"
14 proto_config_add_string "service"
15 proto_config_add_string "pincode"
22 json_get_var device device
24 json_get_var service service
25 json_get_var pincode pincode
28 proto_set_available "$interface" 0
34 chat="/etc/chatscripts/evdo.chat"
37 chat="/etc/chatscripts/3g.chat"
38 cardinfo=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom)
39 if echo "$cardinfo" | grep -q Novatel; then
45 export MODE="AT\$NWRAT=${CODE},2"
46 elif echo "$cardinfo" | grep -q Option; then
52 export MODE="AT_OPSYS=${CODE}"
53 elif echo "$cardinfo" | grep -q "Sierra Wireless"; then
55 elif echo "$cardinfo" | grep -qi huawei; then
57 umts_only) CODE="14,2";;
58 gprs_only) CODE="13,1";;
61 export MODE="AT^SYSCFG=${CODE},3FFFFFFF,2,4"
64 if [ -n "$pincode" ]; then
65 PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
66 proto_notify_error "$interface" PIN_FAILED
67 proto_block_restart "$interface"
71 [ -n "$MODE" ] && gcom -d "$device" -s /etc/gcom/setmode.gcom
73 # wait for carrier to avoid firmware stability bugs
75 gcom -d "$device" -s /etc/gcom/getcarrier.gcom || return 1
80 connect="${apn:+USE_APN=$apn }/usr/sbin/chat -t5 -v -E -f $chat"
81 ppp_generic_setup "$interface" \
94 proto_kill_command "$interface"