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 proto_set_available
"$interface" 0
41 chat
="/etc/chatscripts/evdo.chat"
44 chat
="/etc/chatscripts/3g.chat"
45 cardinfo
=$
(gcom
-d "$device" -s /etc
/gcom
/getcardinfo.gcom
)
46 if echo "$cardinfo" |
grep -q Novatel
; then
52 export MODE
="AT\$NWRAT=${CODE},2"
53 elif echo "$cardinfo" |
grep -q Option
; then
59 export MODE
="AT_OPSYS=${CODE}"
60 elif echo "$cardinfo" |
grep -q "Sierra Wireless"; then
62 elif echo "$cardinfo" |
grep -qi huawei
; then
64 umts_only
) CODE
="14,2";;
65 gprs_only
) CODE
="13,1";;
68 export MODE
="AT^SYSCFG=${CODE},3FFFFFFF,2,4"
71 if [ -n "$pincode" ]; then
72 PINCODE
="$pincode" gcom
-d "$device" -s /etc
/gcom
/setpin.gcom ||
{
73 proto_notify_error
"$interface" PIN_FAILED
74 proto_block_restart
"$interface"
78 [ -n "$MODE" ] && gcom
-d "$device" -s /etc
/gcom
/setmode.gcom
80 # wait for carrier to avoid firmware stability bugs
82 gcom
-d "$device" -s /etc
/gcom
/getcarrier.gcom ||
return 1
85 if [ -z "$dialnumber" ]; then
92 connect
="${apn:+USE_APN=$apn }DIALNUMBER=$dialnumber /usr/sbin/chat -t5 -v -E -f $chat"
93 ppp_generic_setup
"$interface" \
106 proto_3g_teardown
() {
107 proto_kill_command
"$interface"
110 [ -z "NOT_INCLUDED" ] || add_protocol
3g