华为EM660 3G模块:CDMA 1x/EVDO模块,EM660与PC linux之间通过USB转换卡(好像某些专业人士叫 USB Dongle,本人比较土,不是很确认)连接。
EM660及其usb转换卡上并无声卡及MIC插孔,故只能测试拨号的ATCommand,不能真正从EM660听到或采集声音。
dmesg
......
[ 6296.331428] USB Mass Storage support registered.
[ 6296.341005] usbserial: USB Serial support registered for GSM modem (1-port)
[ 6296.342582] option 2-1:1.0: GSM modem (1-port) converter detected
[ 6296.344074] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 6296.346149] option 2-1:1.1: GSM modem (1-port) converter detected
[ 6296.347360] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 6296.349502] option 2-1:1.2: GSM modem (1-port) converter detected
[ 6296.350725] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 6296.351945] usbcore: registered new interface driver option
[ 6296.351953] option: USB Driver for GSM modems: v0.7.2
......
有三个串口,ttyUSB2用于电话,ttyUSB0用于无线数据连接,前者用minicom连接,直接输入ATCommand调试,后者,使用pppd 直接连接。
minicom -s
+-----[configuration]------+
| Filenames and paths |
| File transfer protocols |
| Serial port setup |
| Modem and dialing |
| Screen and keyboard |
| Save setup as dfl |
| Save setup as.. |
| Exit |
| Exit from Minicom |
+--------------------------+
+-----------------------------------------------------------------------+
| A - Serial Device : /dev/ttyUSB2 |
| B - Lockfile Location : /var/lock |
| C - Callin Program : |
| D - Callout Program : |
| E - Bps/Par/Bits : 115200 8N1 |
| F - Hardware Flow Control : No |
| G - Software Flow Control : No |
| |
| Change which setting? |
+-----------------------------------------------------------------------+
配置完成后使用minicom连接上ttyUSB2,启动ppp连接。
modprobe ppp_generic
lsmod | grep ppp
ppp_deflate 12800 0
zlib_deflate 28312 1 ppp_deflate
ppp_async 17024 0
ppp_generic 32668 3 ppp_deflate,bsd_comp,ppp_async
slhc 14208 1 ppp_generic
crc_ccitt 10112 2 ppp_async,irda
另一个窗口打开运行:
root@shallon-laptop:/etc/ppp/peers# pppd connect 'chat -v "" "AT" "" "ATDT#777 CONNECT"' user CARD password CARD /dev/ttyUSB0 115200 nodetach crtscts debug usepeerdns defaultroute
Serial connection established.
using channel 5
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <auth chap MD5> <magic 0x234dc7ad>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x5ffb5a8f> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0x0> <auth chap MD5> <magic 0x234dc7ad>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x5ffb5a8f> <pcomp> <accomp>]
sent [LCP EchoReq id=0x0 magic=0x5ffb5a8f]
rcvd [CHAP Challenge id=0x1 <d684a691277263ebab3ee21c15a75715>, name = "GD-GZ-DGZ-PD-74.CDMA"]
sent [CHAP Response id=0x1 <616c3ad66bc645c3875c308716620e3d>, name = "CARD"]
rcvd [LCP EchoRep id=0x0 magic=0x234dc7ad]
rcvd [CHAP Success id=0x1 ""]
CHAP authentication succeeded
CHAP authentication succeeded
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfReq id=0x1 <addr 115.168.82.142>]
sent [IPCP ConfAck id=0x1 <addr 115.168.82.142>]
rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfNak id=0x2 <addr 113.113.52.57> <ms-dns1 202.96.128.86> <ms-dns3 220.192.32.103>]
sent [IPCP ConfReq id=0x3 <addr 113.113.52.57> <ms-dns1 202.96.128.86> <ms-dns3 220.192.32.103>]
rcvd [IPCP ConfAck id=0x3 <addr 113.113.52.57> <ms-dns1 202.96.128.86> <ms-dns3 220.192.32.103>]
Cannot determine ethernet address for proxy ARP
local IP address 113.113.52.57
remote IP address 115.168.82.142
primary DNS address 202.96.128.86
secondary DNS address 220.192.32.103
Script /etc/ppp/ip-up started (pid 15898)
Script /etc/ppp/ip-up finished (pid 15898), status = 0x0
拨入CDMA电话,PPP连接被断掉。
Modem hangup
Connect time 1.1 minutes.
Sent 0 bytes, received 256 bytes.
Script /etc/ppp/ip-down started (pid 15961)
Connection terminated.
Script /etc/ppp/ip-down finished (pid 15961), status = 0x0
下面是这个过程中的电话连接窗口日志:
Welcome to minicom 2.3
OPTIONS: I18n
Compiled on Aug 29 2008, 07:16:49.
Port /dev/ttyUSB2
Press CTRL-A Z for help on special keys
AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
OK
^RSSILVL: 40
^RSSILVL: 20
RING
+CLIP:02032239423,0,,,,0
RING
^CEND:2,0,255
当初测试的时候,不知道PPPD是不应该退出的,正常的情形是PPP连接中无数据输入输出,直到电话打完为止,没想到无意中记录了一种出错的情况,但是居然现在无法在LINUX重现了,只在在windows下重现,问题正在解决。特此记录。
另外用这种方法启动的PPPD,用ifconfig能够看到成功建立了PPP0,用route也能看到相关的路有表,而DNS则需要手动配置。方法是将/etc/ppp/resolv.conf的内容(其实就是pppd的usepeerdns中获取的dns列表)复制到/etc/resolv.conf。特此记录。