sudo apt-get
update
sudo apt-get install ppp usb-modeswitch
wvdial
2、假設核心有支援的話。就直接lsusb,找出其device id。
# lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 005: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard
在可以看出device id為 12d1:1506
3、modprobe usbserial vendor=0x12d1 product=0x1506
#ls -ls /dev/ttyU*
0 crw-rw---T 1 root dialout 188, 0 5月 29 10:50 /dev/ttyUSB0
0 crw-rw---T 1 root dialout 188, 1 5月 29 10:17 /dev/ttyUSB1
0 crw-rw---T 1 root dialout 188, 2 5月 29 10:49 /dev/ttyUSB2
可以看出usb modem有三台 (看廠牌和型號,我有遇過五台的)
4、取出訊號品質。訊號的部份在/dev/ttyUSB0
#more /etc/wvdial.conf (預設的設定檔)
[Dialer Defaults]
Init1 = AT+CSQ
Modem Type = USB Modem
ISDN = 0
New PPPD = yes
Modem = /dev/ttyUSB0
Baud = 9600
Username = " "
Password = " "
Phone = " "
#wvdial
-> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: AT+CSQ
AT+CSQ
+CSQ: 16,99
OK
--> Modem initialized.
--> Sending: ATDT
--> Waiting for carrier.
ATDT
ERROR
--> Invalid dial command.
--> Disconnecting at Thu May 29 10:53:01 2014
5、撥號上網的部份。data com的部份使用/dev/ttyUSB2
# more /etc/reconnect.conf
[Dialer Defaults]
Phone = *99#
APN = internet
Username = " "
Password = " "
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1, "IP","Internet"
;Modem Type = Analog Modem
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB2
ISDN = 0
Stupid Mode = 1
#/usr/bin/wvdial -C /etc/reconnect.conf & (由於非預設設定檔,因此要指定設定檔所在)
6、附錄
部份卡可能要更新kernel才有支援或者要更新firmware: rpi-update
另外有部份網卡要自行compile再insmode或modprobe。就不一一列舉
7、我本來是用ppp直接撥號,但後來發現wvdial有自動重連功能。二話不說就換成wvdial。
附上ppp相關安裝及設定方式,這邊好像是下載別人寫好的script。一時找不到出處,不過因為後來沒有用到,就先找了。
#apt-get install ppp
#cd /etc/ppp/peers
#more gsm (我們看一下gsm的內容)
-detach
lcp-echo-failure 0
/dev/ttyUSB2
115200
debug
defaultroute
usepeerdns
noauth
user ""
ipcp-max-failure 4
ipcp-accept-local
ipcp-accept-remote
ser/pw combo
noauth
crtscts
lock
connect '/usr/sbin/chat -v -t6 -f /etc/ppp/peers/gsm_chat'
#pppd call gsm &(此時就撥號上去了)
# more gsm_chat (我們看一下gsm_chat的內容)
SAY 'Starting Sierra Wireless GSM connect script...\n'
SAY '\n'
SAY 'Setting the abort string\n'
SAY '\n'
# Abort String ------------------------------
ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT 'NO CARRIER' ABORT DELAYED
SAY 'Initializing modem\n'
# Modem Initialization
'' AT
OK ATZ
SAY '\n'
SAY 'Setting APN\n'
OK 'AT+CGDCONT=1,"IP","internet"'
SAY '\n'
SAY 'Dialing...\n'
OK ATD*99#
CONNECT ''
沒有留言:
張貼留言