天道酬勤

博观而约取,厚积而薄发!
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

ralink RT3050拨号上网记录

Posted on 2010-04-29 16:07  Happy Coding  阅读(5984)  评论(0编辑  收藏  举报

用 UBuntu 拨号 wcdma的那个
    发现其实使用的驱动是 option.ko  
    拨号失败,如下: 应该是不需要任何加密,包括VJ 和CCP。 (3G 传输部需要任何加密)
Protocol-Reject for 'Compression Control Protocol' (0x80fd) received

==================================================================

建立 3G拨号镜像的步骤
1. 配置内核,需要添加
            nfs 方便调试
            usbserial  加载驱动
2.    配置其他选项: vendor
            3g  添加拨号工具和脚本
            最好给busybox 加上 netcat  方便调试了。
            
3.    修改配置文件,添加对额外模块的支持,故我们定义如下
     sbin/3g.sh
     etc_ro/web/internet/wan.asp
    


920       <option value="MU-Q101" id="MU-Q101">NU MU-Q101</option>
+                    <option value="MC8630" id="MC8630">ZTE MC8630</option>    
921       <option value="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

压缩 格式 MPPC
PPP多重链路  关

    ***  2009-7-24 15:47   要么是太高明, 要么是太罗了, /dev 竟然是只读的?  
    是我错了, 这里要读取一个变量,但是好像根本没有这个变量
    ***** 上午的时候是    1.5Mbps   下午的时候可以飙到2.8Mbps 几乎达到3.1Mbps极限。 晚上是1.6Mbps
        发现3g和1x没什么区别, 后来发现还是有的,那怎么才能配置为3G模式那?
    ****   windows 使用的是MPPC,  马上看看pppd 是什么时候就重拨的?
        persist
    maxfail 0
    **** 试试加入几个初始化
  ttyACM0<*1>: ATQ0 V1 E1 -- OK
  ttyACM0<*1>: ATQ0 V1 E1 Z -- OK
  ttyACM0<*1>: ATQ0 V1 E1 S0=0 -- OK
  ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
  ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
  ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +F -- OK

atz
ATQ0 V1 E1 S0=0 &C1 &D2 +F -- OK
ATQ0 V1 E1 S0=0 &C1 &D2 +F>evdo ?????
http://hi.baidu.com/netbusy/blog/item/4a7bfc80c61793df9123d95a.html    3g 和 1x的区别
Password = ctnet@mycdma.cn
Username = vnet.mobi
而且3G拨号上去以后 第二串口有 这样的信息

^HRSSILVL:80

^HRSSILVL:60

把天线拔开后:
^HRSSILVL:20

^DSDORMANT:1

^HRSSILVL:0

^MODE:2
再插上以后,马上变成了
^HRSSILVL:60

^MODE:8

^HRSSILVL:80

另外 atz 执行不执行还是有区别的,
atz之后串口就可echo,否则看不到自己的输入
看来以后调试3g还是要在windows上先调试好了在接到板子上调试。


但是EVDO 自己拨号上去怎么  压缩变成了无????


        **** 试试用acm 而不是usbserial
        
    
persist                                
holdoff  <t>
demand    
idle     <t>   按需连接
lock                给串口设备加锁
debug                    调试
plugin radius.so        传输加密插件
plugin radattr.so        



insmod /etc_ro/usbserial.ko  vendor=0x19d2 product=0xfffe
pppd debug  nodetach logfd 1  connect  'chat -t 1 -v -s  "" at OK ATH NOOK ' /dev/ttyUSB1  115200
    断开3g 连接
/etc_ro/ppp/ip-up
    ddns.sh
/etc_ro/ppp/ip-down
    ttyUSB1  disconnect
chmod 700 /etc_ro/ppp/chap-secrets
    "loginpppoe"    *       "123456"        *
    
    
goahead: waiting for nvram_daemon internet.sh
Password for 'admin' changed
insmod: bridge.ko: module not found
insmod: mii.ko: module not found
insmod: raeth.ko: module not found

phy_tx_ring = 0x008d6000, tx_ring = 0xa08d6000

phy_rx_ring = 0x00000000, rx_ring = 0x00000000
RT305x_ESW: Link Status Changed
CDMA_CSG_CFG = 81000007
GDMA1_FWD_CFG = 710000
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
ifconfig: ioctl 0x8913 failed: No such device
rmmod: rt2860v2_ap: No such file or directory
rmmod: rt2860v2_sta: No such file or directory
Commit crc = d19ee91b
rt2860v2_ap: module license 'unspecified' taints kernel.


=== pAd = c0002000, size = 397432 ===

<-- RTMPAllocAdapterBlock, Status=0
rmmod: nf_nat_pptp: No such file or directory
rmmod: nf_conntrack_pptp: No such file or directory
rmmod: nf_nat_proto_gre: No such file or directory
rmmod: nf_conntrack_proto_gre: No such file or directory
RX DESC a0a99000  size = 2048
<-- RTMPAllocTxRxRingMemory, Status=0
1. Phy Mode = 9
2. Phy Mode = 9
The EEPROM in Flash are wrong, use default
3. Phy Mode = 9
MCS Set = ff 00 00 00 01
Main bssid = 00:0c:43:30:52:88
<==== rt28xx_init, Status=0
0x1300 = 00064380
insmod: 8021q.ko: module not found
ifconfig: ioctl 0x8913 failed: No such device
brctl: bridge br0: No such device or address
iptables v1.3.5: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.3.5: can't initialize iptables table `mangle': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
##### config RT3052 vlan partition (WLLLL) #####
switch reg write offset=14, value=405555
switch reg write offset=50, value=2001
switch reg write offset=98, value=7f3f
switch reg write offset=e4, value=3f
switch reg write offset=40, value=1002
switch reg write offset=44, value=1001
switch reg write offset=48, value=1001
switch reg write offset=70, value=ffff417e
device ra0 entered promiscuous mode
eth2.1: dev_set_promiscuity(master, 1)
device eth2 entered promiscuous mode
device eth2.1 entered promiscuous mode
br0: port 2(eth2.1) entering learning state
br0: port 1(ra0) entering learning state
ifconfig: ioctl 0x8914 failed: Cannot assign requested address
ifconfig: ioctl 0x8914 failed: Cannot assign requested address
killall: udhcpd: no process killed
Set: phy[1].reg[0] = 3900
Set: phy[2].reg[0] = 3900
Set: phy[3].reg[0] = 3900
Set: phy[4].reg[0] = 3900
Set: phy[1].reg[0] = 3100
Set: phy[2].reg[0] = 3100
Set: phy[3].reg[0] = 3100
Set: phy[4].reg[0] = 3100
ifconfig: ioctl 0x8913 failed: No such device
killall rt2860apd 1>/dev/null 2>&1
iptables -F -t filter 1>/dev/null 2>&1
iptables -D FORWARD -j macipport_filter 1>/dev/null 2>&1
iptables -F macipport_filter 1>/dev/null 2>&1
iptables -D FORWARD -j web_filter  1>/dev/null 2>&1
iptables -F web_filter  1>/dev/null 2>&1
iptables -P INPUT ACCEPT
iptables v1.3.5: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables -P OUTPUT ACCEPT
iptables v1.3.5: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables -P FORWARD ACCEPT
iptables v1.3.5: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables -t filter -N web_filter 1>/dev/null 2>&1
iptables -t filter -N macipport_filter 1>/dev/null 2>&1
iptables -t filter -A FORWARD -j web_filter 1>/dev/null 2>&1
iptables -t filter -A FORWARD -j macipport_filter 1>/dev/null 2>&1
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 1>/dev/null 2>&1
iptables -A INPUT -i ppp0 -p tcp --dport 80 -j DROP
iptables v1.3.5: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables -t nat -D PREROUTING -j port_forward 1>/dev/null 2>&1
iptables -t nat -F port_forward  1>/dev/null 2>&1; iptables -t nat -X port_forward  1>/dev/null 2>&1
iptables -t nat -D PREROUTING -j DMZ 1>/dev/null 2>&1
iptables -t nat -F DMZ 1>/dev/null 2>&1; iptables -t nat -X DMZ  1>/dev/null 2>&1
iptables -t nat -N port_forward 1>/dev/null 2>&1; iptables -t nat -I PREROUTING 1 -j port_forward 1>/dev/null 2>&1
iptables -t nat -N DMZ 1>/dev/null 2>&1; iptables -t nat -I PREROUTING 2 -j DMZ 1>/dev/null 2>&1
ntp.sh
ddns.sh
route delete 239.255.255.250 1>/dev/null 2>&1
killall wscd 1>/dev/null 2>&1
killall -9 wscd 1>/dev/null 2>&1
iwpriv ra0 set WscConfMode=0 1>/dev/null 2>&1
killall -q klogd
killall -q syslogd
syslogd -C8 1>/dev/null 2>&1
klogd 1>/dev/null 2>&1
route add -net 192.168.1.0  netmask 255.255.255.0 dev eth2.2 2>&1
killall -q zebra
killall -q ripd

##### USB init #####
storage.sh admin
sh: storage.sh: not found
webs: Listening for HTTP requests at address 10.10.10.254
we use MC8630, no need usb_modeswitch
br0: topology change detected, propagating
br0: port 2(eth2.1) entering forwarding state
br0: topology change detected, propagating
br0: port 1(ra0) entering forwarding state
rmmod: usbserial: No such file or directory
rmmod: hso: No such file or directory
usbcore: registered new interface driver usbserial

cat  /dev/mtd1

ebInit=1HostName=ralinkLogin=adminPassword=adminOperationMode=1Platform=RT
3052wanConnectionMode=3Gwan_ipaddr=192.168.1.1wan_netmask=255.255.255.0wa
n_gateway=192.168.1.254wan_primary_dns=192.168.1.5wan_secondary_dns=168.95.
1.1wan_pppoe_user=pppoe_userwan_pppoe_pass=pppoe_passwdwan_l2tp_server=l2t
p_serverwan_l2tp_user=l2tp_userwan_l2tp_pass=l2tp_passwdwan_l2tp_mode=0wan_l2t
p_ip=192.168.1.1wan_l2tp_netmask=255.255.255.0wan_l2tp_gateway=192.168.1.254
wan_pptp_server=pptp_serverwan_pptp_user=pptp_userwan_pptp_pass=pptp_passwdw
an_pptp_mode=0wan_pptp_ip=192.168.1.1wan_pptp_netmask=255.255.255.0wan_pp
tp_gateway=192.168.1.254lan_ipaddr=10.10.10.254lan_netmask=255.255.255.0dhcp
Enabled=1dhcpStart=10.10.10.100dhcpEnd=10.10.10.200dhcpMask=255.255.255.0dh
cpPriDns=10.10.10.251dhcpSecDns=168.95.1.1dhcpGateway=10.10.10.254dhcpLease
=86400stpEnabled=0lltdEnabled=0igmpEnabled=0natEnabled=1IPPortFilterEnable=0I
PPortFilterRules=PortForwardEnable=0PortForwardRules=MacFilterEnable=0MacFilterRul
es=DefaultFirewallPolicy=1DMZEnable=0DMZIPAddress=TZ=NTPServerIP=NTPSync=DD
NSProvider=DDNS=DDNSAccount=DDNSPassword=CountryRegion=5CountryRegionABan
d=7CountryCode=BssidNum=1SSID1=RT305x_APWirelessMode=9TxRate=0Channel=
6BasicRate=15BeaconPeriod=100DtimPeriod=1TxPower=100DisableOLBC=0BGProtecti
on=0TxAntenna=RxAntenna=TxPreamble=0RTSThreshold=2347FragThreshold=2346
TxBurst=1PktAggregate=1TurboRate=0WmmCapable=1APAifsn=3;7;1;1APCwmin=4;
4;3;2APCwmax=6;10;4;3APTxop=0;0;94;47APACM=0;0;0;0BSSAifsn=3;
7;2;2BSSCwmin=4;4;3;2BSSCwmax=10;10;4;3BSSTxop=0;0;94;47BSSACM=0;
0;0;0AckPolicy=0;
0;0;0APSDCapable=0DLSCapable=0NoForwarding=0NoForwardingBTNBSSID=0HideSSI
D=0ShortSlot=1AutoChannelSelect=0SecurityMode=0VLANEnable=0VLANName=VLANID
=0VLANPriority=0WscConfMode=0WscConfStatus=2WscAKMP=1WscConfigured=1WscM
odeOption=0WscActionIndex=9WscPinCode=WscRegResult=1WscUseUPnP=1WscUse
UFD=0WscSSID=RalinkInitialAPWscKeyMGMT=WPA-
EAPWscConfigMethod=138WscAuthType=1WscEncrypType=1WscNewKey=scaptestIEEE
8021X=0IEEE80211H=0CSPeriod=6PreAuth=0AuthMode=SHAREDEncrypType=WEPRek
eyInterval=3600RekeyMethod=DISABLEPMKCachePeriod=10WPAPSK1=12345678Defa
ultKeyID=3Key1Type=0Key1Str1=aaaaaaaaaaKey2Type=0Key2Str1=aaaaaaaaaaKey3
Type=0Key3Str1=aaaaaaaaaaKey4Type=0Key4Str1=aaaaaaaaaaHSCounter=0HT_HT
C=1HT_RDG=1HT_LinkAdapt=0HT_OpMode=0HT_MpduDensity=5HT_EXTCHA=1HT_BW
=1HT_AutoBA=1HT_BADecline=0HT_AMSDU=0HT_BAWinSize=64HT_GI=1HT_STBC=1H
T_MCS=33HT_PROTECT=1HT_MIMOPS=3HT_40MHZ_INTOLERANT=0HT_TxStream=2H
T_RxStream=2NintendoCapable=0AccessPolicy0=1AccessControlList0=AccessPolicy1=0
AccessControlList1=AccessPolicy2=0AccessControlList2=AccessPolicy3=0AccessControlL
ist3=WdsEnable=0WdsEncrypType=NONEWdsList=WdsKey=WirelessEvent=0RADIUS_S
erver=0RADIUS_Port=1812RADIUS_Key=ralinkRADIUS_Acct_Server=RADIUS_Acct_Port
=1813RADIUS_Acct_Key=session_timeout_interval=0idle_timeout_interval=0staWireles
sMode=9WAN_MAC_ADDR=FF:FF:FF:FF:FF:FF

RFICType=ffTXPath=fRXPath=fLanguage=zhcnRoutingRules=192.168.1.0,255.255.25
5.0,0.0.0.0,WAN,eth2.2,,wan_3g_dev=MC8630macCloneEnabled=0staWPSMode=0own
_ip_addr=10.1.1.11EAPifname=br0PreAuthifname=br0




 
insmod usbserial vendor=0x19d2 product=0x0094


哈哈 ,终于抓到了, 在windows下面, 把最关键的那个USB设备( usb composite device )停用。 拔插一下,再停用一次, 然后用 Devcie monitor studio 把数据抓下来, 这次 数据少多了。 (可惜我的电脑一到此时就死机了,faint)
抓的时候先启动 DMS,选择 next connected device, 启动监视。
在抓下来的包中寻找 对原始设备地址的 0x9端点的写入数据。 就是那些 55 53 42 43 ,然后处理一下 搞到usbswitcher.conf中。
55 53 42 43 好像是SCSI storage类的数据格式, 现在没时间分析 USB storage 协议, 不管了。
先插入 ZTE AC560 模块,  编辑配置文件
        #  cat /etc/usb_modeswitch.conf

DefaultVendor=  0x19d2
DefaultProduct= 0x0026
TargetVendor=   0x19d2
TargetProduct=  0x0094
        
MessageEndpoint=0x09
Target 0x00
MessageContent="55534243D00B47892400000080000685000000240000000000000000000000"

    $ usb_modeswitch  
    立刻识别出6个接口
    
T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=0094 Rev= 0.00
S:  Manufacturer=ZTE, Incorporated
S:  Product=ZTE EVDO Technologies MSM
C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=128ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=84(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=87(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=07(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=88(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=08(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usbserial_generic
E:  Ad=89(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=09(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usbserial_generic
E:  Ad=8a(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=0b(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

    又一个犯人的地方。  Cls=08(stor.) Sub=06 Prot=50   一看就知道是usbstorage设备
    只是如果先插入 usbstorage 驱动,   这个烂dwc_otg就供重启运动了。
    如果先插入 usbserial  ,最后两个设备驱动就错了。  不过先不理它了,先试试拨号吧。
        insmod usbserial vendor=0x19d2  product=0x0094
    
    ******   插入usbstorage 会导致 EMI, 那么这个问题应该是电源管理的问题了, 这个需要查查解决了。
    ******   usbserial 需要修改驱动, 对 PID=0094的设备要继续判断 Subclass, 或者记住驱动完整情况下,要先插入usb-storage.
            .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | USB_DEVICE_ID_MATCH_DEVICE
            .idVendor = (vend), \
      .idProduct = (prod)
      .bInterfaceClass = (cl), \
          .bInterfaceSubClass = (sc),
          .bInterfaceProtocol = (pr)
    那么就再试试串口的一半收发功能。
        pppd debug  nodetach logfd 1  connect  'chat -t 1  -v -s  "" at  OK ATH CONNECT' /dev/ttyUSB1  115200
    

serial_set_termios

serial_write - port 1, 1 byte(s)
usb_serial_generic_write - port 1
<7>OUT NAK enhancement disabled, no core support
usb_serial_generic_write_bulk_callback - port 1
usb_serial_port_work - port 1
<4>DWC_otg: hc_xfer_timeout: timeout on channel 1
DWC_otg:        start_hcchar_val 0x0158a040
    
usb_serial_port_work - port 1
serial_write - port 1, 1 byte(s)
usb_serial_generic_write - port 1
<7>OUT NAK enhancement disabled, no core support
usb_serial_generic_write_bulk_callback - port 1    
    
    
小惑:
****** 因为gadaet zero 有一个转换的过程, 转换过程中 PID 都变了,所以下次你再插入的时候还是可以识别出多个设备的, 按理说我禁用的不是最一开始switch之前的设备,但是两次禁用后下次插入就只识别出一个停用的设备。 这个还没有搞清楚, 对windows 的 USB设备驱动还不太了解。


检测驱动 EMI
***********************
hub 1-0:1.0: port 1 disabled by hub (EMI?), re-enabling...
usb 1-1: USB disconnect, address 4
usb 1-1: new full speed USB device using dwc_otg and address 5

发生以下状态
    USB_PORT_STAT_ENABLE
    
    hub_port_status
    
    get_port_status
         ret = get_port_status(hub->hdev, port1, &hub->status->port);
              status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
                  USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port1,
                  data, sizeof(*data), USB_STS_TIMEOUT);


hub_port_connect_change(hub, i,            portstatus, portchange);




试下华为的WCDMA, 这个应该简单了
首先停用那个跟设备 usb composite device
开启usb 监视

000016: Bulk or Interrupt Transfer (DOWN), 29.07.2009 11:50:22.203 +0.0
Pipe Handle: 0x892b78a4 (Endpoint Address: 0x1)
Send 0x1f bytes to the device
 55 53 42 43 00 00 00 00 00 00 00 00 00 00 00 11   USBC............
 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00      ...............

把设备停掉后, 识别出了3G USB Fake(com38) HUAWEI Mobile


E1750
没有用的参数
DetachStorageOnly=1  
HuaweiMode=1

        #  cat /etc/usb_modeswitch.conf

DefaultVendor=  0x12d1
DefaultProduct= 0x1446
TargetVendor=   0x12d1
TargetProduct=  0x1001
MessageEndpoint=0x01
Target 0x00
MessageContent="55534243000000000000000000000011060000000000000000000000000000"
    
好, 下面把所有的初始化脚本都去掉,
 把usb core  hub 中 EMI判断的那些去掉, 然后把读到的状态原始值记录下来
 把 dbg 驱动的printk修改一下,没有\n 打印的乱七八糟的

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  7 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1001 Rev= 0.00
S:  Manufacturer=HUAWEI Technology
S:  Product=HUAWEI Mobile
C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usbserial_generic
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usbserial_generic
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms


现在可以确定 re_enable 的问题是由于 获得了设备的错误状态所致,该 状态为 USB_PORT_STAT_ENABLE
GET_STATUS

see  drivers/usb/core/hub.h
/*        
 * wPortStatus bit field
 * See USB 2.0 spec Table 11-21
 */           
#define USB_PORT_STAT_CONNECTION  0x0001
#define USB_PORT_STAT_ENABLE    0x0002
#define USB_PORT_STAT_SUSPEND   0x0004
#define USB_PORT_STAT_OVERCURRENT 0x0008
#define USB_PORT_STAT_RESET   0x0010
/* bits 5 to 7 are reserved */
#define USB_PORT_STAT_POWER   0x0100
#define USB_PORT_STAT_LOW_SPEED   0x0200
#define USB_PORT_STAT_HIGH_SPEED        0x0400
#define USB_PORT_STAT_TEST              0x0800
#define USB_PORT_STAT_INDICATOR         0x1000
/* bits 13 to 15 are reserved */
         
    *** insmod dwc_otg dma_enable=0   不适用dma 直接就挂了
        insmod usbserial  vendor=0x12d1 product=0x1001


        
        RT305x_ESW: Link Status Changed reg=0x4000000  这个是在 lan.sh 之后出现的
        
        ifconfig eth2  0.0.0.0
        vconfig add eth2 1
        vconfig add eth2 2
        ifconfig eth2.1  0.0.0.0
        ifconfig eth2.2  0.0.0.0
        lan.sh
        ifconfig eth2.1 10.1.1.12
        
        vconfig  是 vlan  的配置工具 (  802.1q  即Virtual Bridged Local Area Networks协议
                http://zhidao.baidu.com/question/12768572.html?si=2&wtp=wk
            通过使用vlan 可以 划分交换机的端口,提高优先级高的包的传输速度,Qos, 支持组播。
            这里应该只是用来划分交换机端口的,如果配置不正确时无法访问的。
            而这个lan.sh 应该还设置了寄存器, 等, 连网络状态都变了。
            如果要虚拟的网络可以访问, eth2必须设置为 0.0.0.0
            
        
        hub 1-0:1.0: port 1 disabled by hub (EMI?), status=0x100re-enabling...
        hub 1-0:1.0: port 1 disabled by hub (EMI?), status=0x500re-enabling...
        按照 USB2.0定义  GET_STATUS  只有最低2bit有效, 那么其实可以完全不管这个标记的。
        无需重启什么的。 可以为什么这些3G模块这几个字段都有值哪?
        

===================================================================================
1. 常见错误:
        tcsetattr: Invalid argument (line 961)
        不能设置参数, 这个原来以为驱动有问题, 但是 只有重新上点3g模块就好了。 然后就没有错误了。
        看来3G模块的确需要一个复位信号。
        

===================================================================================
1. DDNS  NTP
2.DDNS  配置
3322的更新还有更加简单的办法,连客户端都不用安装,也不用配置文件,不用知道IP,使用lynx(一般的Linux, BSD都自带), 就可以了!

使用方法:
lynx -mime_header -auth=user : pass "http://www.3322.org/dyndns/update?system=dyndns&hostname=myhost.3322.org"
更新协议:
    http://www.3322.org/dyndnspage/protocol.html
希网动态域名——相关协议
    http://www.3322.org/dyndnspage/codes.html
希网动态域名——返回码解
Source :
    http://www.3322.org/download/ez-ipupdate-3.0.10.tgz
使用方法:
lynx -mime_header -auth=user : pass "http://www.3322.org/dyndns/update?system=dyndns&hostname=myhost.3322.org"

http://wwzbwwzb:ciscos@members.3322.org/dyndns/update?system=dyndns&hostname=wwzbwwzb.3322.org

2. pppd 参数解析

/dev/ttyUSB0
115200
connect '/bin/chat -v -f /tmp/unicom'            
    用 chat 交互脚本   -v  -f 表示使用stdout stderr 来记录拨号交互过程, 但是好像参数是在配置文件中,仍然不打印出来???
debug   启用调试,有错误打印信息
noipdefault
    不适用默认的IP,而是用ppp拨号的IP
nodetach
    表示拨号后不离开终端, 调试功能
usepeerdns
    使用ppp传过来的DNS,会传递给ip-up两个参数DNS1,DNS2,包含两个dns地址,并且建立文件/var/run/ppp/resolv.conf
ipcp-accept-local
ipcp-accept-remote
    使用ppp peer传递过来的PtoP的IP地址选项,(而不是用户指定的)
defaultroute
    添加一条默认路由
require-pap
    指定认证方式是chap认证, 需要有/chap-secrets文件, 或者指定用户名密码。
#login
user card
password card

show-password            明文显示密码

persist/demand                                     
holdoff  <t>
idle     <t>   按需连接
        指定连接时间, persisit表示会一直连接, demand只在需要的时候才连接
        holdoff  指定距离下次重拨等待时间(s)
        idle   表示在ppp空闲指定时间后断开
lock                给串口设备加锁
debug                    调试
plugin radius.so        传输加密插件
plugin radattr.so        


3. iptables:
        table   chain  rules
    -t  指定表: nat  filter  raw mangle   默认为 filter
    -L  list
    -n
    -D  -X  delete chain
    -I  list chain
    -R replace
    -F  flush chain,  delete rules one by one
    -A  append chain
    
    -p  procotol  see /etc/protocol
    -s  source address
    -d  destination address
    -j  jump target,  but counter of rules still increased
    -g  goto chain
    
    -v  verbose
    
    
iptables  -t  filter  -D
nat

==================================================================================================
1. 三个模块的参数info

MC8630  电信CDMA1x   EVDV模块
    vendor=0x19d2   product=0xfffe
user=pass= TIM   拨号EVDO
user=pass= CARD   拨号EVDO
拨号: ATD#777
额外初始化
额外支持功能: 短信,语音
Max baudrate   


HUAWEI  E1750  联通WCDMA模块
    vendor=0x12d1    product=0x1001
user=pass=     
拨号: ATD*99#
额外初始化
额外支持功能: 短信,
Max baudrate   460800
EndPoint Num: 5
AT+CFUN=  设置操作模式
ath不管用。断线命令  AT+CFUN   (呵呵, hack it), 想继续拨号只能重启了。  ?  应该是ath0试试
有时无法拨号,需要重启, 在第一个端口拨号。
Port1: Modem
Port2: Diag(nostic) Interface
Port3: AT  Interface
Port4: CD_ROM storage
Port5: storage


ZTE  AC560     电信EVDE  CDMA1  模块
    vendor=0x12d1    product=0x1001
如何拨号EVDO :
Password = ctnet@mycdma.cn
Username = vnet.mobi
拨号CDMA1x
user=pass= CARD   
拨号: ATD#777
额外初始化
额外支持功能: 短信,
Max baudrate   310000    最高可以916000
modeswitch 之后 product变成了0x0094
EndPoint Num: 6
*****在第三端口初始化 atz
         发现开始连接的时候要在第三个串口输入初始化at命令,否则,串口一连发送接收都有问题。
Port1: Modem
Port2: Diag Interface
Port3: AT  Interface
Port4: Sound Interface  
Port5: CD_ROM storage
Port6: storage


Connect: ppp0 <--> /dev/ttyUSB0
rcvd [LCP ConfReq id=0x1 <mru 1448> <asyncmap 0x0> <auth chap MD5> <magic 0x6dcf0517> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xf28934d4> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <mru 1448> <asyncmap 0x0> <auth chap MD5> <magic 0x6dcf0517> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xf28934d4> <pcomp> <accomp>]
rcvd [CHAP Challenge id=0x2 <30aaecff3c5eea2d125e48894c32d62c>, name = "utstar.com"]
sent [CHAP Response id=0x2 <22fe9a08ec56f8a499c6adeaaedc4d94>, name = "card"]
rcvd [CHAP Success id=0x2 "\000"]
CHAP authentication succeeded:
sent [CCP ConfReq id=0x1 <mppe -H -M -S -L -D -C> <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=0x3 <compress VJ 07 00> <addr 115.168.43.146>]
sent [IPCP ConfAck id=0x3 <compress VJ 07 00> <addr 115.168.43.146>]
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 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [CCP ConfReq id=0x2 <mppe -H -M -S -L -D -C>]
rcvd [IPCP ConfNak id=0x1 <compress VJ 07 00> <addr 122.229.62.237> <ms-dns1 202.101.172.37> <ms-dns3 202.101.173.157>]
sent [IPCP ConfReq id=0x2 <compress VJ 07 00> <addr 122.229.62.237> <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.62.237> <ms-dns1 202.101.172.37> <ms-dns3 202.101.173.157>]
local  IP address 122.229.62.237
remote IP address 115.168.43.146
primary   DNS address 202.101.172.37
secondary DNS address 202.101.173.157
Script /etc_ro/ppp/ip-up started (pid 931)