免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3194 | 回复: 2
打印 上一主题 下一主题

[应用] pppd用ttyS1拨号失败后,重新打开ttyS1提示No such devices or address [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-10-29 11:17 |只看该作者 |倒序浏览
如题,linux下调用pppd进行拨号,有时候会出现pppd中断后再重新设置串口会返回No such devices or address的问题。
平台:AT公司的9G20 + linux-2.6.27版本内核;
pppd版本:2.4.4;
GPRS模块:泰利特公司的GC864模块。

pppd拨号脚本如下:
#/etc/ppp/peers/gprs
# This is pppd script for China Mobile, used Huawei GTM900-B GPRS Module
# Usage:   root>pppd call gprs
/dev/ttyS1
115200
nocrtscts
modem
#noauth
debug
nodetach
#hide-password
usepeerdns
noipdefault
defaultroute
user "3GNET"
0.0.0.0:0.0.0.0
#ipcp-accept-local
#ipcp-accept-remote
#lcp-echo-failure  12
#lcp-echo-interval 3
#noccp
#novj
#novjccomp
#persist
connect '/mnt/iRTK/bin/chat -s -v -f /etc/ppp/gprs-connect-chat'
#connect '/usr/sbin/chat -s -v -f /etc/ppp/gprs-connect-chat'
#connect '/bin/chat -v -s -f /etc/ppp/gprs-connect-chat
#disconnect '/bin/chat -v -f /etc/ppp/gprs-disconnect-chat'
-----------------------------------------------------------------------------------
chat命令脚本如下:
#/etc/ppp/gprs-connect-chat
# chat script for China Mobile, used HuaWei GTM900-B GPRS module.
TIMEOUT         15
ABORT           "DELAYED"
ABORT           "BUSY"
ABORT           "ERROR"
ABORT           "NO DIALTONE"
ABORT           "NO CARRIER"
TIMEOUT         40
''              \rAT
OK                ATS0=0
OK              ATE0V1
OK              AT+CGDCONT=1,"IP","3GNET"
OK              ATDT*99***1#
CONNECT         ''
-----------------------------------------------------------------------------------

拨号过程打印信息如下:

timeout set to 15 seconds
abort on (DELAYED)
abort on (BUSY)
abort on (ERROR)
abort on (NO DIALTONE)
abort on (NO CARRIER)
timeout set to 40 seconds
send (^MAT^M)
expect (OK)
^M
OK
-- got it

send (ATS0=0^M)
expect (OK)
^M
^M
OK
-- got it

send (ATE0V1^M)
expect (OK)
^M
^M
OK
-- got it

send (AT+CGDCONT=1,"IP","3GNET"^M)
expect (OK)
^M
^M
OK
-- got it

send (ATDT*99***1#^M)
expect (CONNECT)
^M
^M
CONNECT
-- got it

send (^M)
Serial connection established.
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/ttyS1
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9654b07c> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x9654b07c> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <auth pap> <magic 0xcc6e0000> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0x0> <auth pap> <magic 0xcc6e0000> <pcomp> <accomp>]
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
sent [PAP AuthReq id=0x1 user="3GNET" password=<hidden>]
rcvd [PAP AuthAck id=0x1 "Welcome!"]
Remote message: Welcome!
PAP authentication succeeded
sent [CCP ConfReq id=0x1 <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=0x1 <addr 192.168.202.0>]
sent [IPCP ConfAck id=0x1 <addr 192.168.202.0>]
rcvd [LCP ProtRej id=0x1 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
Modem hangup
Connection terminated.

打印上述信息之后,程序会kill掉pppd进程。重新调用open去打开串口是正常的,但调用tcsetattr函数去设置串口参数的时候,会返回No such devices or address的错误。但此时/dev目录下的ttyS1还是在的。但感觉就是ttyS1被pppd占用了,导致这样一个错误。

不知道有没有遇到这种现象的朋友,也求大神指导,这个问题困扰好多天了。

论坛徽章:
0
2 [报告]
发表于 2013-10-29 15:57 |只看该作者
怎么都没人回复呢?求助啊!!!!

论坛徽章:
1
技术图书徽章
日期:2013-10-29 15:46:41
3 [报告]
发表于 2013-11-01 14:17 |只看该作者
被lock了吧 你到/var/lock下看看有没这个设备,删了试试
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP