首页 > 代码库 > 路由器上调试3G拨号

路由器上调试3G拨号

建立 3G拨号镜像的步骤
1. 配置内核,需要添加
            nfs 方便调试
            usbserial  加载驱动
2.    配置其他选项: vendor
            3g  添加拨号工具和脚本
最好给busybox 加上 netcat  方便调试了。
3.    修改配置文件,添加对额外模块的支持,故我们定义如下
     sbin/3g.sh
     etc_ro/web/internet/wan.asp
920       <option value="http://www.mamicode.com/MU-Q101" id="MU-Q101">NU MU-Q101</option>
+                    <option value="http://www.mamicode.com/MC8630" id="MC8630">ZTE MC8630</option>   
921       <option value="http://www.mamicode.com/HUAWEI-E169" id="E169">HUAWEI E169</option>
elif [ "$dev" = "HUAWEI-E169" ]; then
        usb_modeswitch -c /etc_ro/usb/usb_modeswitch_HUAWEI-E169.conf
+elif [ "$dev" = "MC8630" ]; then
+                echo  "we use MC8630, no need usb_modeswitch"
elif [ "$dev" = "HUAWEI-E169" ]; then
        vend_id="0x12d1"       
        prod_id="0x1001"  
+elif [ "$dev" = "MC8630" ]; then
+                vend_id="0x19d2"       
+                prod_id="0xfffe"       
-insmod usbserial vendor=$vend_id product=$prod_id
+insmod /etc_ro/usbserial.ko vendor=$vend_id product=$prod_id
if [ "$dev" != "OPTION-ICON225" ]; then 
-        config-3g-ppp.sh -p pass -u user -m $modem_f -c Generic_conn.scr -d Generic_disconn.scr
+        config-3g-ppp.sh -p CARD -u CARD -b 115200 -m $modem_f -c my_conn.scr -d Generic_disconn.sc
        pppd call 3g
4. 编译 my_conn.scr
-send "ATD*99#^m"
+send "ATD#777^m"
- set com 115200n81
+set com 310000n81
-    send "AT+CFUN=1;+CGDCONT=1,\"IP\",\"Internet\"^m"
-    waitfor 10 "OK","ERR","ERROR"
try remeber{
    vendor=0x19d2   product=0xfffe
    +              config-3g-ppp.sh -p CARD -u CARD -b 460800 -m $modem_f -c Generic_conn.scr -d Generic_disconn.sc
}
4.  编译镜像, 并加载, 在web界面选择3G模块
5.
=================================================================================
6. 调试记录
其它可能的初始化和AT配置(从官方截取的配置)
    Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +F>ISDN = 0
Auto Reconnect = off   
crtscts
lock
asyncmap 20A0000
kdebug 4
-detach
lcp-echo-failure 4
lcp-echo-interval 30
ipcp-max-failure 30
ipcp-max-configure 30
-ccp
-vj
    nvram_get 2860 wan_3g_dev
    lan_ip=`nvram_get 2860 lan_ipaddr`
stp_en=`nvram_get 2860 stpEnabled`
nat_en=`nvram_get 2860 natEnabled`
bssidnum=`nvram_get 2860 BssidNum`
radio_off=`nvram_get 2860 RadioOff`
获得flash paramter 中 3G模块的配置信息
            # nvram_get 2860  wan_3g_dev
            HUAWEI-E169
    ralink_init make_wireless_config rt2860     ??? 设置 flash  paramter
ralink_init make_wireless_config rt2860  
是否这个配置导致 pppd 问题
    cat /dev/mtd1  可以打印所有的环境变量, 不过要拷贝后格式化一下再看。
网络
# iwpriv
mkdir /var/lock
cat /var/log/ppp-connect-errors
pppd debug  -nodetach  crtscts lock connect ‘chat "" atd#777 CONNECT‘  /dev/ttyUSB0  115200
chat  -v -s  "" atdt#777 CONNECT
    -s  ouput to stderr but SYSLOG, all message will be send to stderr
    -S  don‘t use SYSLOG
    -e  enable echo to stdout
pppd debug  nodetach logfd 1  connect  ‘chat  -v -s  "" at  OK atdt#777 CONNECT‘ /dev/ttyUSB0  115200
logfile a.txt
        notty      不用tty, allowed a pseudo-tty
        pty  special  pty command to connect remote
ANSER:
61 <7>OUT NAK enhancement disabled, no core support
64 <7>OUT NAK enhancement disabled, no core support
74 <7>OUT NAK enhancement disabled, no core support
37 <7>OUT NAK enhancement disabled, no core support
37 <7>OUT NAK enhancement disabled, no core support
37 <7>OUT NAK enhancement disabled, no core support
0d <7>OUT NAK enhancement disabled, no core support
# pppd file 3g
send (at^M)
expect (OK)
at^M^M
OK
-- got it
send (ath^M)
expect (OK)
^M
ath^M^M
OK
-- got it
send (atdt#777^M)
expect (CONNECT)
^M
atdt#777^M^M
CONNECT
-- got it
Serial connection established.
using channel 5
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
rcvd [LCP ConfReq id=0x1 <mru 1448> <asyncmap 0x0> <auth chap MD5> <magic 0x4f5e7508> <pcomp> <accomp>]
Warning - secret file /etc_ro/ppp/pap-secrets has world and/or group access
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x8fc751f0> <pcomp> <accomp>]
sent [LCP ConfNak id=0x1 <auth pap>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x8fc751f0> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x2 <mru 1448> <asyncmap 0x0> <auth pap> <magic 0x4f5e7508> <pcomp> <accomp>]
sent [LCP ConfAck id=0x2 <mru 1448> <asyncmap 0x0> <auth pap> <magic 0x4f5e7508> <pcomp> <accomp>]
Warning - secret file /etc_ro/ppp/pap-secrets has world and/or group access
sent [PAP AuthReq id=0x1 user="card" password=<hidden>]
rcvd [PAP AuthAck id=0x1 ""]
PAP authentication succeeded
sent [CCP ConfReq id=0x1 <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=0x3 <compress VJ 07 00> <addr 115.168.43.12>]
sent [IPCP ConfAck id=0x3 <compress VJ 07 00> <addr 115.168.43.12>]
rcvd [CCP ConfReq id=0x4 <mppe -H -M -S -L -D +C>]
sent [CCP ConfRej id=0x4 <mppe -H -M -S -L -D +C>]
rcvd [CCP ConfRej id=0x1 <bsd v1 15>]
sent [CCP ConfReq id=0x2]
rcvd [IPCP ConfNak id=0x1 <compress VJ 07 00> <addr 122.229.143.56> <ms-dns1 202.101.172.37> <ms-dns3 202.101.173.157>]
sent [IPCP ConfReq id=0x2 <compress VJ 07 00> <addr 122.229.143.56> <ms-dns1 202.101.172.37> <ms-dns3 202.101.173.157>]
rcvd [CCP TermAck id=0x5]
sent [CCP TermReq id=0x3"No compression negotiated"]
rcvd [IPCP ConfAck id=0x2 <compress VJ 07 00> <addr 122.229.143.56> <ms-dns1 202.101.172.37> <ms-dns3 202.101.173.157>]
local  IP address 122.229.143.56
remote IP address 115.168.43.12
primary   DNS address 202.101.172.37
secondary DNS address 202.101.173.157
Script /etc_ro/ppp/ip-up started (pid 956)
rcvd [CCP TermAck id=0x3]
RT305x_ESW: Link Status Changed
RT305x_ESW: Link Status Changed
/dev/ttyUSB0
460800
connect ‘/bin/chat -t 3 -v -f  /tmp/unicom ‘
disconnect ‘echo disconnect now >> /tmp/pppdis‘
debug
noipdefault
nodetach
usepeerdns
ipcp-accept-local
ipcp-accept-remote
defaultroute
require-chap
#login
user card
password card
remotename
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"
ABORT "BUSY"
TIMEOUT 120
"" at
OK atz    
OK "ATQ0 V1 E1 S0=0 &C1 &D2 +F
OK atdt#777
CONNECT
pppd debug auth login user card password card  nodetach logfd 1  connect  ‘chat  -v -s  "" at  OK atdt#777 CONNECT‘ /dev/ttyUSB0  115200
     pppd debug  nodetach logfd 1  connect  ‘chat  -v -s  "" at  OK  ath  OK atdt#777 CONNECT‘ /dev/ttyUSB0  115200
避免已经拨号上线。
USE :
     pppd debug  nodetach logfd 1  connect  ‘chat -t 13  -v -s  "" at  OK atdt#777 CONNECT‘ /dev/ttyUSB0  115200
     pppd debug  nodetach logfile /tmp/log   connect  ‘chat  -v -s  "" at  OK atdt#777 CONNECT‘ /dev/ttyUSB0  115200
     pppd debug  nodetach logfd 1  connect  ‘chat -t 1  -v -s  "" at  OK ATH CONNECT‘ /dev/ttyUSB1  115200
     pppd debug  nodetach logfd 1  connect  ‘chat  -v -s  "" at  OK at CONNECT‘ /dev/ttyUSB1  115200
disconnect ‘‘   断开的时候执行的命令
show-password            明文显示密码
122.229.95.19
115. 168.43.151

路由器上调试3G拨号