关于4G模块的移植,请参考上一节html
http://www.javashuo.com/article/p-gnqpzjav-gp.htmlnode
ppp脚本,主要包含3个脚本文件,一个是须要pppd调用的脚本,还有一个chat是运营商的拨号脚本linux
// 在文件系统的 /etc 目录下,建立 ppp 目录 在 /etc/ppp 目录下建立 peers 目录vim
gprs脚本:ide
# vim /etc/ppp/peers/gprs
#/etc/ppp/peers/gprs
# This is pppd script for China Mobile, used GPRS Module
# Usage: root>pppd call gprsspa
debug nodetach /dev/ttyUSB0 115200 nocrtscts modem #noauth debug #nodetach #hide-password usepeerdns noipdefault defaultroute user "cmnet" 0.0.0.0:0.0.0.0 ipcp-accept-local #ipcp-accept-remote #lcp-echo-failure 12 #lcp-echo-interval 3 #noccp #novj #novjccomp #persist #connect '/usr/sbin/chat -s -v -f /etc/ppp/gprs-connect-chat' connect '/sbin/chat -v -s -f /etc/ppp/gprs-connect-chat' #disconnect '/bin/chat -v -f /etc/ppp/gprs-disconnect-chat'
另外一个脚本.net
# vim etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
"cmnet" * "cmnet" * debug
拨号脚本:server
终端输入:vim /etc/ppp/gprs-connect-chathtm
移动:
#Chat script for China Mobile, used SIMCOM sim4100 TD module.
TIMEOUT 15
ABORT "DELAYED"
ABORT "BUSY"
ABORT "ERROR"
ABORT "NO DIALTONE"
ABORT "NO CARRIER"
TIMEOUT 40
'' \rAT
OK ATS0=0
OK ATE0V1
OK AT+CGDCONT=1,"IP","CMNET"
OK AT+CGEQREQ=1,2,128,384,,,0,,,,,,
OK ATDT*99*1#
CONNECT
联通:
TIMEOUT 5
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT 'NODIALTONE'
ABORT 'BUSY'
ABORT 'NO ANSWER'
'' \rAT
OK \rATZ
OK \rAT+CGDCONT=1,"IP","3GNET",,0,0
OK-AT-OK ATDT*99#
CONNECT \d\c
关于脚本的详细解释,请参考: https://blog.csdn.net/duloveding/article/details/8287758
https://www.linuxidc.com/Linux/2011-03/33430p2.htm (三大运营商的脚本)
脚本设置好后,重启。
首先尝试和模块通讯,查看知否正常。
终端输入:
echo “AT+CSQ” > /dev/ttyUSB2
而后:cat /dev/ttyUSB2
就能够查看信号强度,若是链接正常,就会收到回复,也能够试试其余的指令
若是都正常,最后启动拨号:
ping一下谷歌:
参考文档:
http://www.cnblogs.com/chenfulin5/p/6951290.html?tdsourcetag=s_pcqq_aiomsg
https://blog.csdn.net/duloveding/article/details/8287758
https://www.linuxidc.com/Linux/2011-03/33430p2.htm
https://blog.csdn.net/duloveding/article/details/8287758
https://www.linuxidc.com/Linux/2011-03/33430p2.htm
https://www.v2ex.com/t/328730
https://blog.csdn.net/skdkjzz/article/details/22209371
https://blog.csdn.net/qq_41546323/article/details/78930780
http://www.javashuo.com/article/p-buirznvu-na.html (有一个文档能够下载参考 关于i.mux6移植)
注意:天线也很重要,一开始我觉得不须要天线也能够,顶可能是信号差一点,可是实际上,没有天线是不行的,我试的根本没法启动拨号,因此一直的时候ifconfgi没有获取到ip ME909s天线接在标有M的接口,有三个的天线接在标有M端口的