亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2393 | 回復(fù): 2
打印 上一主題 下一主題

嵌入式linux下通過ppp撥號gprs [復(fù)制鏈接]

論壇徽章:
1
技術(shù)圖書徽章
日期:2013-10-29 15:46:41
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-12-21 08:41 |只看該作者 |倒序?yàn)g覽
1. 加入內(nèi)核支持:
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下可執(zhí)行程序pppd, chat, pppdump, pppstats拷貝到開發(fā)板/usr/sbin目錄下

5. mkdir /etc/ppp; mkdir /etc/ppp/peers
然后建立如下4個文件:
1)/etc/ppp/peers/gprs
/dev/s3c2410_serial1
115200
nocrtscts ##important! 一定要注意這里,開發(fā)板與PC機(jī)不同,沒有硬件流控,導(dǎo)致我chat總是沒有回應(yīng),折騰了一上午才發(fā)現(xiàn)!
nodetach   ##去掉該項,撥號就在后臺運(yùn)行。
noauth
usepeerdns
noipdefault
ipcp-accept-local
ipcp-accept-remote
defaultroute
user itlanger
connect '/usr/sbin/chat -s -v -f /etc/ppp/chat-gprs-connect'

2) /etc/ppp/chat-gprs-connect
TIMEOUT 5
ECHO ON
ABORT '\nBUSY\r'
ABORT '\nERROR\r'
ABORT '\nNO ANSWER\r'
ABORT '\nNO CARRIER\r'
ABORT '\nNO DIALTONE\r'

TIMEOUT 5
'' AT
OK ATE0

TIMEOUT 60
SAY "Press CTRL-C to break the connection process.\n"
OK AT+CGREG=1
OK AT+CGATT=1
OK 'AT+CGDCONT=1,"IP","CMNET"'
OK AT+CGQMIN=1,0,0,0,0,31
OK AT+CGACT=1,1
OK ATDT*99***1#

TIMEOUT 60
SAY "Waiting for connect...\n"
CONNECT ''
SAY "Connect Success!\n"

3) /etc/ppp/pap-secrets
itlanger        *       ''

4) /etc/ppp/chap-secrets
itlanger        *       ''


6. 進(jìn)行撥號連接:
[root@srp-arm /]# /usr/sbin/pppd call gprs
timeout set to 5 seconds
abort on (\nBUSY\r)
abort on (\nERROR\r)
abort on (\nNO ANSWER\r)
abort on (\nNO CARRIER\r)
abort on (\nNO DIALTONE\r)
timeout set to 5 seconds
send (AT^M)
expect (OK)

^M
OKOK
-- got it

send (ATE0^M)
timeout set to 60 seconds
Press CTRL-C to break the connection process.
expect (OK)

^M

^M
OKOK
-- got it

send (AT+CGREG=1^M)
expect (OK)

^M

^M
OKOK
-- got it

send (AT+CGATT=1^M)
expect (OK)

^M

^M
OKOK
-- got it

send (AT+CGDCONT=1,"IP","CMNET"^M)
expect (OK)

^M

^M
OKOK
-- got it

send (AT+CGQMIN=1,0,0,0,0,31^M)
expect (OK)

^M

^M
OKOK
-- got it

send (AT+CGACT=1,1^M)
expect (OK)

^M

^M
OKOK
-- got it

send (ATDT*99***1#^M)
timeout set to 60 seconds
Waiting for connect...
expect (CONNECT)

^M

^M
CONNECTCONNECT
-- got it

send (^M)
Connect Success!

Serial connection established.
Using interface ppp0
Connect: ppp0 <--> /dev/s3c2410_serial1
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
Warning - secret file /etc/ppp/chap-secrets has world and/or group access
CHAP authentication succeeded
CHAP authentication succeeded
not replacing existing default route via 192.168.0.1
local IP address 10.24.19.4
remote IP address 192.168.254.254
primary   DNS address 211.137.160.5
secondary DNS address 211.136.17.107



7. 解決問題:
1)解決出現(xiàn)的警告:
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
Warning - secret file /etc/ppp/chap-secrets has world and/or group access
只要去掉這兩個文件的權(quán)限即可:
chmod 600 /etc/ppp/*-secrets

2) 后臺撥號:
去掉gprs文件中的nodetach
并且 mkdir /var/log

3)關(guān)閉ppp連接
在控制終端中用CTRL-C就可以斷開連接
在后臺可以用如下腳本文件實(shí)現(xiàn): /etc/ppp/ppp-off
#!/bin/sh

if [ -r /var/run/ppp0.pid ]; then
   kill -INT `cat /var/run/ppp0.pid`
fi

if [ ! "$?" = "0" ]; then
    rm -f /var/run/ppp0.pid
        echo "ERROR: close ppp0 failed!"
        exit 1
fi
              
echo "SUCCESS: ppp0 was closed!"
exit 0


8. 發(fā)現(xiàn)使用ppp撥號后,就再也不用AT指令建立socket連接了,方便多了。
哈哈。。。

論壇徽章:
0
2 [報告]
發(fā)表于 2012-04-16 16:25 |只看該作者
學(xué)習(xí)下!

論壇徽章:
0
3 [報告]
發(fā)表于 2012-04-18 10:42 |只看該作者
mark~~~
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP