我正在尝试使用 SIM800L 和 PL2303 USB 串行电缆建立 GPRS 连接。
如果我屏幕或者微型计算机调制解调器(115200 8N1)我立即收到调制解调器的响应,即使在设置 PDP 和 GPRS 上下文后,我仍可以通过 AT 命令成功 ping google 服务器。我还可以通过AT+CGDATA="PPP"
或启动 PPP 连接ATDT*99***1#
。
但随着拨号调制解调器没有响应
--> WvDial: Internet dialer version 1.61
--> Cannot set information for serial port.
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
--> Re-Sending: ATZ
--> Modem not responding.
如果我做了cat /dev/ttyUSB0
并运行拨号同时我得到了这个:
ATZ0
OK
OK
OK
后拨号结束了命令和第一个OK
出现时,一秒钟后两个OK
会出现。另外我想指出的是,ATZ
和ATQ0
命令变成了重叠。
我可能会通过以下方式劫持输出猫这可能是原因,但行为拨号有无都一样猫。
这是我的/etc/wvdial.conf
[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 115200
Phone = *99***1#
Username = webgprs
Password = webgprs2002
New PPPD = yes
Modem Type = Analog Modem
没什么区别。如果我输入一些Init#
参数,他们也不会得到任何响应。命令重叠也会发生在Init#
命令上。
获得抽象层,如带有 pppd 的 3G 和 GPRS 调制解调器导致仅使用pppd 简介也不起作用。很明显,系统进程与串行端口的通信没有被阻止,只能通过串行端口客户端进行。
sakis3g与调制解调器成功通信但无法启动接口。
[13751] [11:45:56] Connection command that will be used is: /usr/bin/setsid /usr/sbin/pppd /dev/ttyUSB0 460800 modem crtscts -detach defaultroute dump noipdefault usepeerdns usehostname ktune logfd 2 noauth name sakis3g lock maxfail 3 connect "/usr/sbin/chat -v -f /tmp/pppd.tmp.13751" user "webgprs" password "webgprs2002"
[13751] [11:45:56] Verbosing: 28% Initializing modem
[13751] [11:45:56] Using default INITIALIZE.
[13751] [11:45:56] Command "INITIALIZE" refers to AT commands: ATZ OK 'AT&F' OK 'ATQ0 V1 E1' OK 'AT&D2 &C1' OK AT+FCLASS=0 OK ATS0=0 OK 'AT+CGDCONT=1,"IP","internet.itelcel.com"' OK
[13751] [11:45:56] Will send INITIALIZE commands to tty /dev/ttyUSB0: "" '\pAT' OK ATZ OK 'AT&F' OK 'ATQ0 V1 E1' OK 'AT&D2 &C1' OK AT+FCLASS=0 OK ATS0=0 OK 'AT+CGDCONT=1,"IP","internet.itelcel.com"' OK '\pAT' OK
[13751] [11:45:57] We are root already. Proceeding.
[13751] [11:45:57] Device /dev/ttyUSB0 is not busy.
[13751] [11:45:58] Got response from tty:
AT
OK
ATZ
OK
AT&F
OK
ATQ0 V1 E1
OK
AT&D2 &C1
OK
AT+FCLASS=0
ERROR
[13751] [11:45:58] Unknown command "STAGE7".
[13751] [11:45:58] Unknown command "STAGE8".
[13751] [11:45:58] We are root already. Proceeding.
/-------------------------------------------------------------------------------
[13751] [11:45:58] Will now run command: \'/bin/rm -f "/tmp/sakis3g.3gnet"\'
/-------------------------------------------------------------------------------
\-------------------------------------------------------------------------------
[13751] [11:45:58] Command returned 0.
\-------------------------------------------------------------------------------
[13751] [11:45:58] We are root already. Proceeding.
[13751] [11:45:58] Device /dev/ttyUSB0 is not busy.
[13751] [11:45:58] Verbosing: 35% Connecting
[13751] [11:45:58] PID 15625 is still running.
[13751] [11:45:59] Located "netstat" within PATH (/bin/netstat).
[13751] [11:45:59] Waiting for interface to go up (0 seconds passed).
[13751] [11:46:00] PID 15625 is still running.
[13751] [11:46:00] Waiting for interface to go up (1 seconds passed).
[13751] [11:46:01] PID 15625 is still running.
[13751] [11:46:01] Waiting for interface to go up (2 seconds passed).
... (truncated) ...
[13751] [11:46:56] Waiting for interface to go up (20 seconds passed).
[13751] [11:46:57] Giving up waiting for connection to occur.
[13751] [11:46:57] PID 16179 is still running.
[13751] [11:46:58] PID 16179 is not running any more.
[13751] [11:46:58] PID 16179 is not running any more.
[13751] [11:46:58] Failed to connect.
[13751] [11:46:58] Error: Failed to connect.
[13751] [11:46:58] Aborting execution chain due to actor "connect" returning 95.
即使我手动设置 PDP 上下文并将调制解调器设置为 GPRS 活动上下文,结果仍然相同
AT+CIPSTATUS
IP STATUS
答案1
通过阅读 sakis3g 日志和源代码,我注意到nocrtscts
必须使用 ppp 选项来连接此 PL2303 USB 串行转换器。此外,SIM800L 不支持AT+FCLASS
命令,导致聊天脚本失败,因此我不得不将其删除。
使用来自的聊天脚本带有 pppd 的 3G 和 GPRS 调制解调器我改了一下行:
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
到
'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2'
用于AT+FCLASS
选择传真模式。如果您的 GSM 模块甚至不支持此模式(或默认为 0 -- 数据模式),那么将该部分从聊天脚本中省略似乎是安全的。
答案2
我已将此问题追溯到 libwvstreams(以及 wvdial)默认使用的 RTS/CTS 流控制,但我的微型 USB 串行加密狗不支持。
您可以使用我在 GitHub 上的补丁或者在硬件中修复它。例如,如果您的加密狗有 RTS 和 CTS 引脚(而您的调制解调器没有),您可以将它们相互连接。