在Linux 的命令中存在BusyBox
与microcom
串行调制解调器通信的命令:
BusyBox v1.13.2 (2012-05-10 17:13:08 CEST) multi-call binary
Usage: microcom [-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY
Copy bytes for stdin to TTY and from TTY to stdout
Options:
-d Wait up to DELAY ms for TTY output before sending every next byte to it
-t Exit if both stdin and TTY are silent for TIMEOUT ms
-s Set serial line to SPEED
-X Disable special meaning of NUL and Ctrl-X from stdin
我不想使用标准输入键入 AT 命令,而是将它们放入一个文本文件中,并将该文件的内容重定向为上述命令的标准输入。例如,我有一个文件
/tmp/at.txt
使用 AT 命令AT
,通常由 TTY 使用OK
. 使用标准输入的标准会话如下所示:
microcom -t 3000 -X /dev/ttyS5
at
OK
其中字符串at
是直接在键盘上输入的。为了使用文件的内容/tmp/at.txt
(只包含'at\n')。去做这个,。我尝试了以下变体:
microcom -t 3000 -X /dev/ttyS5 < /tmp/at.txt
microcom -t 3000 /dev/ttyS5 < /tmp/at.txt
cat /tmp/at.txt | microcom -t 3000 /dev/ttyS5
tail -f /tmp/at.txt | microcom -t 3000 /dev/ttyS5
cat /tmp/at.txt | microcom -t 3000 /dev/ttyS5 -X
tail -f /tmp/at.txt | microcom -t 3000 /dev/ttyS5 -X
并且它们都不起作用,即这些命令都没有在屏幕上返回文本“OK”。因此,我得出结论,将文件内容重定向/tmp/at.txt
为命令的标准输入存在一些问题microcom
。也许与如何解释行尾或文件结尾有关。如果有人有一些想法,我将不胜感激。
谢谢,
亚历克斯