- 论坛徽章:
- 0
|
移植PPP2.4.5到ARM进行TD-SCDMA网络的拨号
使用环境: PC宿主机:sony VAIO Ubuntu10.10 ARM核心板:友善之臂micro2440的核心板 TD-SCDMA模块:SIMCOM Sim4200
1. 加入内核支持: Device Drivers -> Network device support->PPP (point-to-point protocol) support PPP multilink support (EXPERIMENTAL) PPP support for async serial ports PPP support for sync tty ports PPP Deflate compression PPP BSD-Compress compression
2. 下载ppp wget -c ftp://ftp.samba.org/pub/ppp/ppp-2.4.5.tar.gz
3. 交叉编译 # ./configure # make CC=arm-linux-gcc
4. 将目录下pppd chat pppdump pppstats下可执行程序pppd, chat, pppdump, pppstats拷贝到开发板/usr/sbin目录下
5. mkdir /etc/ppp; mkdir /etc/ppp/peers
然后建立如下4个文件:
1)/etc/ppp/peers/hsdpa------------------------------------------------------------------------------>
# example configuration for a dialup connection authenticated with PAP or CHAP # # This is the default configuration used by pon(1) and poff(1). # See the manual page pppd(8) for information on all the options.
# MUST CHANGE: replace myusername@realm with the PPP login name given to # your by your provider. # There should be a matching entry with the password in /etc/ppp/pap-secrets # and/or /etc/ppp/chap-secrets. #user "myusername@realm"
# MUST CHANGE: replace ******** with the phone number of your provider. # The /etc/chatscripts/pap chat script may be modified to change the # modem initialization string. #connect "/usr/sbin/chat -s -v -f /etc/chatscripts/pap -T ********"
connect "/usr/sbin/chat -s -v -f /etc/ppp/hsdpa-connect-chat" # Serial device to which the modem is connected. #/dev/modem /dev/ttyUSB0
# Speed of the serial line. 115200
nocrtscts
modem
lock
debug
nodetach # Assumes that your IP address is allocated dynamically by the ISP.noipdefault # Try to get the name server addresses from the ISP. usepeerdns # Use this connection as the default route. defaultroute
# Makes pppd "dial again" when the connection is lost. persist
# Do not ask the remote to authenticate. noauth
defaultroute
asyncmap 0
#设置接入的用户名,在chap-secrests 和pap-secrets中使用 user "ming"
0.0.0.0:0.0.0.0 #本地和远端的ip都设为0使得接入的isp分配本地的ip地址
ipcp-accept-local #要求peer也就是isp给自己分配动态的ip地址
#ipcp-accept-remote #lcp-echo-failure 12 #lcp-echo-interval 3 noccp #不需要压缩控制协议,有可能对端不需要,根据自己的isp的情况确定 #novj #novjccomp #-mn
2) /etc/ppp/hsdpa-connect-chat------------------------------------------------------->
TIMEOUT 15 ABORT BUSY ABORT "NO CARRIER" ABORT "NO ANSWER" ABORT RINGING ABORT "+CME ERROR:100" TIMEOUT 40
'' \rAT '' AT+CGREG=0 '' AT+CFUN=1 '' AT OK AT+CGDCONT=1,"IP","CMNET",,0,0 OK AT+CGEQREQ=1,2,128,384,0,0,0,0,"0E0","0E0",,0,0 OK AT OK AT OK ATS0=0 OK AT OK AT OK ATDT*98*1# CONNECT ''
3) /etc/ppp/pap-secrets------------------------------------------------------------->
# # /etc/ppp/pap-secrets # # This is a pap-secrets file to be used with the AUTO_PPP function of # mgetty. mgetty-0.99 is preconfigured to startup pppd with the login option # which will cause pppd to consult /etc/passwd (and /etc/shadow in turn) # after a user has passed this file. Don't be disturbed therefore by the fact # that this file defines logins with any password for users. /etc/passwd # (again, /etc/shadow, too) will catch passwd mismatches. # # This file should block ALL users that should not be able to do AUTO_PPP. # AUTO_PPP bypasses the usual login program so it's necessary to list all # system userids with regular passwords here. # # ATTENTION: The definitions here can allow users to login without a # password if you don't use the login option of pppd! The mgetty Debian # package already provides this option; make sure you don't change that.
# INBOUND connections
# Every regular user can use PPP and has to use passwords from /etc/passwd * hostname "" *
# UserIDs that cannot use PPP at all. Check your /etc/passwd and add any # other accounts that should not be able to use pppd! guest hostname "*" - master hostname "*" - root hostname "*" - support hostname "*" - stats hostname "*" -
# OUTBOUND connections
# Here you should add your userid password to connect to your providers via # PAP. The * means that the password is to be used for ANY host you connect # to. Thus you do not have to worry about the foreign machine name. Just # replace password with your password. # If you have different providers with different passwords then you better # remove the following line.
# * password ming * 123456 *
4) /etc/ppp/chap-secrets------------------------------------------------------->
# Secrets for authentication using CHAP # client server secret IP addresses ming * 123456 *
6. 进行拨号连接: 拨号前需要先启动Sim4200板子,然后在通过usbserial把Sim4200的接口转换为虚拟的串口ttyUSB*,使用 ttyUSB0来进行拨号的。 在终端输入modprobe usbserial vendor=0x1e0e product=0xde19就可以进行转换来,如果转换出问题 的话,可能是你的usbserial安装有问题的,mini2440自带的linux镜像里面是把usbserial编译到内核里面 但是他们是无法识别出Sim4200的,要么你就重新修改对于的usbserial的option,然后把usbserial编译到 内核,或者重新编译下内核,把usbserial编译成为模块。下面的这个命令的使用是把usbserial编译成模块的。 具体的操作看Sim42XX的文档。
[root@FriendlyARM ppp]# modprobe usbserial vendor=0x1e0e product=0xde19 usbcore: registered new interface driver usbserial USB Serial support registered for generic usbserial_generic 1-1.1:1.0: generic converter detected usb 1-1.1: generic converter now attached to ttyUSB0 usbserial_generic 1-1.1:1.1: generic converter detected usb 1-1.1: generic converter now attached to ttyUSB1 usbserial_generic 1-1.1:1.2: generic converter detected usb 1-1.1: generic converter now attached to ttyUSB2 usbserial_generic 1-1.1:1.3: generic converter detected usb 1-1.1: generic converter now attached to ttyUSB3 usbserial_generic 1-1.1:1.4: generic converter detected usb 1-1.1: generic converter now attached to ttyUSB4 usbserial_generic 1-1.1:1.5: generic converter detected usb 1-1.1: generic converter now attached to ttyUSB5 usbcore: registered new interface driver usbserial_generic usbserial: USB Serial Driver core
然后再通过 pppd call hsdpa就可以进行拨号。 [root@FriendlyARM ppp]# pppd call hsdpa timeout set to 15 seconds abort on (BUSY) abort on (NO CARRIER) abort on (NO ANSWER) abort on (RINGING) abort on (+CME ERROR:100) timeout set to 40 seconds send (^MAT^M) send (AT+CGREG=0^M) send (AT+CFUN=1^M) send (AT^M) expect (OK) ^M OK -- got it send (AT+CGDCONT=1,"IP","CMNET",,0,0^M) expect (OK) ^M ^M OK -- got it send (AT+CGEQREQ=1,2,128,384,0,0,0,0,"0E0","0E0",,0,0^M) expect (OK) ^M ^M OK -- got it send (AT^M) expect (OK) ^M ^M +CREG: 2^M ^M $M2MSRVST:0,0^M ^M ^MODE:0,0^M ^M ^MODE:0,0^M ^M OK -- got it send (AT^M) expect (OK) ^M ^M OK -- got it send (ATS0=0^M) expect (OK) ^M ^M OK -- got it send (AT^M) expect (OK) ^M ^M OK -- got it send (AT^M) expect (OK) ^M ^M OK -- got it send (ATDT*98*1#^M) expect (CONNECT) ^M ^M OK^M ^M OK^M ^M OK^M ^M CONNECT -- got it send (^M) Script /usr/sbin/chat -s -v -f /etc/ppp/hsdpa-connect-chat finished (pid 606), 0 Serial connection established. using channel 1 Using interface ppp0 Connect: ppp0 <--> /dev/ttyUSB0 Warning - secret file /etc/ppp/pap-secrets has world and/or group access sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xc7e983d> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x0 <mru 1500> <asyncmap 0xffffffff> <auth pap> <magic 0x1] sent [LCP ConfAck id=0x0 <mru 1500> <asyncmap 0xffffffff> <auth pap> <magic 0x1] rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xc7e983d> <pcomp> <accomp>] Warning - secret file /etc/ppp/pap-secrets has world and/or group access sent [PAP AuthReq id=0x1 user="ming" password=<hidden>] rcvd [PAP AuthAck id=0x1 "Welcome"] Remote message: Welcome PAP authentication succeeded sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> ] sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> ] rcvd [LCP EchoReq id=0x1 magic=0x11223344] sent [LCP EchoRep id=0x1 magic=0xc7e983d] sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> ] rcvd [IPCP ConfReq id=0x2 <addr 192.168.0.1>] sent [IPCP ConfAck id=0x2 <addr 192.168.0.1>] rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01> <ms-dns2 0.0.0.0>] sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0>] rcvd [IPCP ConfNak id=0x2 <addr 10.72.232.133> <ms-dns1 221.130.33.60>] sent [IPCP ConfReq id=0x3 <addr 10.72.232.133> <ms-dns1 221.130.33.60>] rcvd [IPCP ConfAck id=0x3 <addr 10.72.232.133> <ms-dns1 221.130.33.60>] not replacing existing default route via 59.64.150.1 local IP address 10.72.232.133 remote IP address 192.168.0.1 primary DNS address 221.130.33.60 ^CTerminating on signal 2 Connect time 0.8 minutes. Sent 0 bytes, received 0 bytes. sent [LCP TermReq id=0x2 "User request"] rcvd [LCP TermAck id=0x2] Connection terminated.
拿到来这几个IP就证明拨通来,可以试试ping下IP。 local IP address 10.72.232.133 remote IP address 192.168.0.1 primary DNS address 221.130.33.60
***sim4200也可以使用gprs来拨号的,对于的设置和文件我自己是以gprs开头的。 和hsdpa一样有gprs 和gprs-connect-chat。其余的不变。
装载请说明来源: http://blog.chinaunix.net/space.php?uid=25617967&do=blog&id=277015
参考文档: http://blogold.chinaunix.net/u1/56406/showart_2123524.html
Good Luck! --Edited By PhenixWhite
|
|