这几天用一个USB接口的GPRS上网卡来拨号上网,按照别人的gprs、gprs-connect-chat脚本程序来做的,就是不能成功。我的GPRS上网卡是USB接口,然后它里面有一个PL2303芯片,就是用来USB转串口用的,linux源代码有pl2303.c,是这个芯片的驱动程序,使用/dev/ttyUSB0这个设备文件。
另:我用AT指令集直接拨号时:
AT+CGDCONT=1,IP,CMNET
OK
ATD*99***1#
CONNECT 115200
然后就出现了NO CARRIER
下面是用pppd拨号时显示的内容:
[root@110 root]# pppd file /etc/ppp/gprs
Press CTRL_C to close the connection at any stage!
defining PDP context...
rAT
OK
ATE1
OK
AT+CGDCONT=1,"IP","CMNET"
OK
AT+CGATT=1
OK
waiting for connect...
ATD*99#
CONNECT
IF the following ppp negotiations fail,
try restarting the phone.
Serial connection established.
using channel 9
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
rcvd [LCP ConfReq id=0x1 <mru 1500> <asyncmap 0x0> <pcomp> <accomp> <auth pap>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xbfb0a81d> <pcomp> <accomp>]
sent [LCP ConfRej id=0x1 <auth pap>]
rcvd [LCP ConfRej id=0x1 <magic 0xbfb0a81d>]
sent [LCP ConfReq id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x2 <mru 1500> <asyncmap 0x0> <pcomp> <accomp>]
sent [LCP ConfAck id=0x2 <mru 1500> <asyncmap 0x0> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0>]
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
rcvd [LCP TermReq id=0x3]
LCP terminated by peer
sent [LCP TermAck id=0x3]
Connection terminated.
Sending break to the modem
PDP context detached
Serial link disconnected.
反正不能成功,下面是gprs、gprs-connect-chat的脚本程序:
gprs:
#File
#gprs
#
debug
debug
debug
/dev/ttyUSB0
115200
crtscts
local
nodetach
connect /etc/ppp/gprs-connect-chat
noipdefault
ipcp-accept-local
ipcp-accept-remote
novj
novjccomp
disconnect /etc/ppp/gprs-disconnect-chat
defaultroute
gprs-connect-chat:
#!/bin/sh
#
# This is part 2 of the ppp-on script. It will perform the connection
# protocol for the desired connection.
#
exec /usr/sbin/chat -v \
TIMEOUT 5 \
ECHO ON \
ABORT '\nBUSY\r' \
ABORT '\nNO ANSWER\r' \
ABORT '\nNO CARRIER\r' \
ABORT '\nRINGING\r\n\r\nRINGING\r' \
'' \rAT \
SAY "
ress CTRL_C to close the connection at any stage!" \
SAY "\ndefining PDP context...\n" \
OK ATE1 \
OK 'AT+CGDCONT=1,"IP","CMNET" ' \
OK AT+CGATT=1 \
OK ATD*99# \
SAY "\nwaiting for connect...\n" \
TIMEOUT 30 \
CONNECT '' \
SAY "\nIF the following ppp negotiations fail,\n" \
SAY "try restarting the phone.\n"
大家看看究竟是怎么回事啊,谢谢了