在用Linux (raspbian)编写的应用程序中,我需要使用串口接收数据。
这是一个半双工数据采集(由RS485),因此,当任何设备发送数据,所有其他必须是侦听。
问题是,在raspbian机器的串口上接收到的每一个字符都被发送回外部设备(用现代术语-- echo
)。即使应用程序没有运行,也会发生这种情况。
这必须是串口的配置(在我的例子中是USBtors232转换器),但是我找不到解决这个问题的方法。
stty命令的输出是:
stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
-brkint -imaxbel
谢谢
发布于 2015-02-03 12:20:50
从我的头顶上,是
stty -F /dev/ttySX raw -echo -echoe -echok -echoke
在手册页上可能会有更多的旗子:
[-]crterase
echo erase characters as backspace-space-backspace
* crtkill
kill all line by obeying the echoprt and echoe settings
* -crtkill
kill all line by obeying the echoctl and echok settings
* [-]ctlecho
echo control characters in hat notation ('^c')
[-]echo
echo input characters
* [-]echoctl
same as [-]ctlecho
[-]echoe
same as [-]crterase
[-]echok
echo a newline after a kill character
* [-]echoke
same as [-]crtkill
[-]echonl
echo newline even if not echoing other characters
* [-]echoprt
echo erased characters backward, between '\' and '/'
https://stackoverflow.com/questions/28298669
复制相似问题