我們用的是極速行800,GPRS無線撥號上網
1.linux的內核在2.6以上已經有了cp2101-cp2102,能夠支持其USB轉串口的要求。具體操作:
a. 插上去應該能自動識別。可以用 dmesg來查看相應的硬件連接情況。
# dmesg
usb 3-2: USB disconnect, address 3
usb 6-2: new full speed USB device using uhci_hcd and address 3
usb 6-2: new device found, idVendor=10c4, idProduct=ea60
usb 6-2: new device strings: Mfr=1, Product=2, SerialNumber=3
usb 6-2: Product: CP2102 USB to UART Bridge Controller
usb 6-2: Manufacturer: Silicon Labs
usb 6-2: SerialNumber: 0001
usb 6-2: configuration #1 chosen from 1 choice
cp2101 6-2:1.0: cp2101 converter detected
usb 6-2: reset full speed USB device using uhci_hcd and address 3
usb 6-2: cp2101 converter now attached to ttyUSB0
可以看出 硬件已經掛載到 /dev/ttyUSB0上。
2.配置wvdial
#vi /etc/wvdial.conf
[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 115200
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init5 = AT+CGDCONT=1, "IP" "CMNET"
Area Code =
Phone = *99***1#
Username = CARD
Password = CARD
Ask Password = 0
Dial Command = ATDT
Stupid Mode = 1
Compuserve = 0
Force Address =
Idle Seconds = 300
DialMessage1 =
DialMessage2 =
ISDN = 0
Auto DNS = 1
FlowControl = Hardware (CRTSCTS)
SetVolume = 0
Modem Type = USB Modem
值得注意的地方是:
1.Init5 = AT+CGDCONT=1, "IP" "CMNET"
這句話一定要加,
AT+CGDCONT=1,"IP","CMNET"
1:表示使用第一種配置方案
IP:表示協議
CMNET:APN
否則出現的錯誤是
The PPP daemon has died: A modem hung up the phone (exit code = 16)
在/var/log/message中對應的信息是:
Jan 9 10:32:43 linux-xrl7 pppd[27961]: Plugin passwordfd.so loaded.
Jan 9 10:32:43 linux-xrl7 pppd[27961]: pppd 2.4.4 started by root, uid 0
Jan 9 10:32:43 linux-xrl7 pppd[27961]: Using interface ppp0
Jan 9 10:32:43 linux-xrl7 pppd[27961]: Connect: ppp0 <--> /dev/ttyUSB0
Jan 9 10:32:46 linux-xrl7 pppd[27961]: CHAP authentication succeeded
Jan 9 10:32:46 linux-xrl7 pppd[27961]: CHAP authentication succeeded
Jan 9 10:32:47 linux-xrl7 pppd[27961]: LCP terminated by peer (!)
Jan 9 10:32:49 linux-xrl7 pppd[27961]: Connection terminated.
Jan 9 10:32:49 linux-xrl7 pppd[27961]: Modem hangup
Jan 9 10:32:49 linux-xrl7 pppd[27961]: Exit.
2,Modem Type = USB Modem
這句也一定要加,否則出現:
--> pppd: [18][17][06][08]
--> Script /etc/ppp/ip-up run successful
--> Default route Ok.
--> warning, can't find address for `www.suse.de`
--> warning, address lookup does not work
--> Nameserver (DNS) failure, the connection may not work.
--> Connected... Press Ctrl-C to disconnect
中國地質大學機器人實驗室Copyright 朱宇