關於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端口的