3 [ -n "$INCLUDE_ONLY" ] || {
12 proto_3g_init_config() {
15 ppp_generic_init_config
16 proto_config_add_string "device:device"
17 proto_config_add_string "apn"
18 proto_config_add_string "service"
19 proto_config_add_string "pincode"
20 proto_config_add_string "dialnumber"
27 json_get_var device device
29 json_get_var service service
30 json_get_var pincode pincode
31 json_get_var dialnumber dialnumber
33 [ -n "$dat_device" ] && device=$dat_device
35 device="$(readlink -f $device)"
37 proto_set_available "$interface" 0
43 chat="/etc/chatscripts/evdo.chat"
46 chat="/etc/chatscripts/3g.chat"
47 cardinfo=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom)
48 if echo "$cardinfo" | grep -q Novatel; then
54 export MODE="AT\$NWRAT=${CODE},2"
55 elif echo "$cardinfo" | grep -q Option; then
61 export MODE="AT_OPSYS=${CODE}"
62 elif echo "$cardinfo" | grep -q "Sierra Wireless"; then
64 elif echo "$cardinfo" | grep -qi huawei; then
66 umts_only) CODE="14,2";;
67 gprs_only) CODE="13,1";;
70 export MODE="AT^SYSCFG=${CODE},3FFFFFFF,2,4"
73 if [ -n "$pincode" ]; then
74 PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
75 proto_notify_error "$interface" PIN_FAILED
76 proto_block_restart "$interface"
80 [ -n "$MODE" ] && gcom -d "$device" -s /etc/gcom/setmode.gcom
82 # wait for carrier to avoid firmware stability bugs
84 gcom -d "$device" -s /etc/gcom/getcarrier.gcom || return 1
87 if [ -z "$dialnumber" ]; then
94 connect="${apn:+USE_APN=$apn }DIALNUMBER=$dialnumber /usr/sbin/chat -t5 -v -E -f $chat"
95 ppp_generic_setup "$interface" \
108 proto_3g_teardown() {
109 proto_kill_command "$interface"
112 [ -z "NOT_INCLUDED" ] || add_protocol 3g