如何使用 RS232 调制解调器初始化 pppd 连接?
How to initialize pppd connection witsh RS232 modem?
我正在尝试 运行 我的嵌入式主板上的 pppd 守护程序。当我将调制解调器连接到 USB 和 运行“pon provider”时,初始化是正确的(我得到 IP 地址,在“ifconfig”中我有 ppp0 接口)
“提供商”文件:
ttyUSB0
115200
lock
crtscts
modem
passive
novj
defaultroute
noipdefault
usepeerdns
noauth
hide-password
persist
holdoff 10
maxfail 0
debug
connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
“移动-modem.chat”文件:
ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
TIMEOUT 6
'' 'ATQ0'
'OK-AT-OK' 'ATZ'
TIMEOUT 3
'OK\d-AT-OK' 'ATI'
'OK' 'ATZ'
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
'OK' @/etc/ppp/chatscripts/mode
'OK-AT-OK' 'AT+CGDCONT=1,"IP","myapn.pl"'
'OK' 'ATDT*99#'
TIMEOUT 30
CONNECT ''
不过,我想 运行 通过 RS232(ttyO1 或 ttyO2)在串行端口上进行 pppd。为此,我将 pppd 文件中的行从“ttyUSB0”更改为“/dev/ttyO2”。不幸的是,即使所有参数都相同,守护程序也不会建立连接,当然除了设备 (ttyO2)。下面我从“/var/log/messages”粘贴日志。我该如何解决这个问题? (发送“AT ^ SYSCFG = 14,2,3fffffff, 0,1 ^ M ^ M”的错误在通过USB连接时也会发生,不会导致连接错误)
daemon.notice pppd[1612]: pppd 2.4.7 started by root, uid 0
local2.info chat[1614]: abort on (BUSY)
local2.info chat[1614]: abort on (NO CARRIER)
local2.info chat[1614]: abort on (VOICE)
local2.info chat[1614]: abort on (NO DIALTONE)
local2.info chat[1614]: abort on (NO DIAL TONE)
local2.info chat[1614]: abort on (NO ANSWER)
local2.info chat[1614]: abort on (DELAYED)
local2.info chat[1614]: report (CONNECT)
local2.info chat[1614]: timeout set to 6 seconds
local2.info chat[1614]: send (ATQ0^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATZ^M)
local2.info chat[1614]: timeout set to 3 seconds
local2.info chat[1614]: expect (OKd)
local2.info chat[1614]: ^M
local2.info chat[1614]: ^M
local2.info chat[1614]: OK^M
local2.info chat[1614]: alarm
local2.info chat[1614]: send (AT^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATI^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: ^M
local2.info chat[1614]: 332^M
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATZ^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (AT\^SYSCFG=14,2,3fffffff,0,1^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: AT^SYSCFG=14,2,3fffffff,0,1^M^M
local2.info chat[1614]: ERROR^M
local2.info chat[1614]: alarm
local2.info chat[1614]: send (AT^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: AT^M^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (AT+CGDCONT=1,"IP","myapn.pl"^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: AT+CGDCONT=1,"IP","myapn.pl"^M^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATDT*99#^M)
local2.info chat[1614]: timeout set to 30 seconds
local2.info chat[1614]: expect (CONNECT)
local2.info chat[1614]: ^M
local2.info chat[1614]: alarm
local2.info chat[1614]: Failed
daemon.debug pppd[1612]: Script /usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat finished (pid 1613), status = 0x3
daemon.err pppd[1612]: Connect script failed
您已指示 pppd 在串行端口上启用 RTSCTS 硬件流控制 (crtscts
)。但是,您还没有在调制解调器端做同样的事情。虚拟USB串口的驱动可能会忽略这个,但真正的串口不会。
如果您打算使用 RTSCTS 流量控制,请确保您已实际连接线路并在调制解调器端启用它(在 AT 手册中有描述)。如果没有,请在 pppd 配置中将其禁用。
我正在尝试 运行 我的嵌入式主板上的 pppd 守护程序。当我将调制解调器连接到 USB 和 运行“pon provider”时,初始化是正确的(我得到 IP 地址,在“ifconfig”中我有 ppp0 接口)
“提供商”文件:
ttyUSB0
115200
lock
crtscts
modem
passive
novj
defaultroute
noipdefault
usepeerdns
noauth
hide-password
persist
holdoff 10
maxfail 0
debug
connect "/usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat"
“移动-modem.chat”文件:
ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
TIMEOUT 6
'' 'ATQ0'
'OK-AT-OK' 'ATZ'
TIMEOUT 3
'OK\d-AT-OK' 'ATI'
'OK' 'ATZ'
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
'OK' @/etc/ppp/chatscripts/mode
'OK-AT-OK' 'AT+CGDCONT=1,"IP","myapn.pl"'
'OK' 'ATDT*99#'
TIMEOUT 30
CONNECT ''
不过,我想 运行 通过 RS232(ttyO1 或 ttyO2)在串行端口上进行 pppd。为此,我将 pppd 文件中的行从“ttyUSB0”更改为“/dev/ttyO2”。不幸的是,即使所有参数都相同,守护程序也不会建立连接,当然除了设备 (ttyO2)。下面我从“/var/log/messages”粘贴日志。我该如何解决这个问题? (发送“AT ^ SYSCFG = 14,2,3fffffff, 0,1 ^ M ^ M”的错误在通过USB连接时也会发生,不会导致连接错误)
daemon.notice pppd[1612]: pppd 2.4.7 started by root, uid 0
local2.info chat[1614]: abort on (BUSY)
local2.info chat[1614]: abort on (NO CARRIER)
local2.info chat[1614]: abort on (VOICE)
local2.info chat[1614]: abort on (NO DIALTONE)
local2.info chat[1614]: abort on (NO DIAL TONE)
local2.info chat[1614]: abort on (NO ANSWER)
local2.info chat[1614]: abort on (DELAYED)
local2.info chat[1614]: report (CONNECT)
local2.info chat[1614]: timeout set to 6 seconds
local2.info chat[1614]: send (ATQ0^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATZ^M)
local2.info chat[1614]: timeout set to 3 seconds
local2.info chat[1614]: expect (OKd)
local2.info chat[1614]: ^M
local2.info chat[1614]: ^M
local2.info chat[1614]: OK^M
local2.info chat[1614]: alarm
local2.info chat[1614]: send (AT^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATI^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: ^M
local2.info chat[1614]: 332^M
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATZ^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: ^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (AT\^SYSCFG=14,2,3fffffff,0,1^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: AT^SYSCFG=14,2,3fffffff,0,1^M^M
local2.info chat[1614]: ERROR^M
local2.info chat[1614]: alarm
local2.info chat[1614]: send (AT^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: AT^M^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (AT+CGDCONT=1,"IP","myapn.pl"^M)
local2.info chat[1614]: expect (OK)
local2.info chat[1614]: ^M
local2.info chat[1614]: AT+CGDCONT=1,"IP","myapn.pl"^M^M
local2.info chat[1614]: OK
local2.info chat[1614]: -- got it
local2.info chat[1614]: send (ATDT*99#^M)
local2.info chat[1614]: timeout set to 30 seconds
local2.info chat[1614]: expect (CONNECT)
local2.info chat[1614]: ^M
local2.info chat[1614]: alarm
local2.info chat[1614]: Failed
daemon.debug pppd[1612]: Script /usr/sbin/chat -v -t15 -f /etc/ppp/chatscripts/mobile-modem.chat finished (pid 1613), status = 0x3
daemon.err pppd[1612]: Connect script failed
您已指示 pppd 在串行端口上启用 RTSCTS 硬件流控制 (crtscts
)。但是,您还没有在调制解调器端做同样的事情。虚拟USB串口的驱动可能会忽略这个,但真正的串口不会。
如果您打算使用 RTSCTS 流量控制,请确保您已实际连接线路并在调制解调器端启用它(在 AT 手册中有描述)。如果没有,请在 pppd 配置中将其禁用。