[英]serial port in linux (raspbian)
我需要在Linux(樹莓派)中用C編寫的應用程序中使用串行端口接收數據。
這是用於半雙工數據采集(通過RS485),因此,當任何設備發送數據時,所有其他設備都必須監聽。
的問題是,raspbian機的串行端口接收到的每個字符被發送回外部裝置(在調制解調器術語- echo
)。 即使應用程序未運行,也會發生這種情況。
這必須是串行端口的配置(在我的情況下是USB到rs232轉換器),但是我找不到解決此問題的方法。
stty命令的輸出為:
stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
-brkint -imaxbel
謝謝
在我的頭頂上
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 '/'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.