8 proto_3g_init_config
() {
11 ppp_generic_init_config
12 proto_config_add_string
"device"
13 proto_config_add_string
"apn"
14 proto_config_add_string
"service"
15 proto_config_add_int
"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
57 if [ -n "$pincode" ]; then
58 PINCODE
="$pincode" gcom
-d "$device" -s /etc
/gcom
/setpin.gcom ||
{
59 proto_notify_error
"$interface" PIN_FAILED
60 proto_block_restart
"$interface"
64 [ -n "$MODE" ] && gcom
-d "$device" -s /etc
/gcom
/setmode.gcom
66 # wait for carrier to avoid firmware stability bugs
68 gcom
-d "$device" -s /etc
/gcom
/getcarrier.gcom ||
return 1
73 connect
="${apn:+USE_APN=$apn }/usr/sbin/chat -t5 -v -E -f $chat"
74 ppp_generic_setup
"$interface" \
87 proto_kill_command
"$interface"