2016-12-21 76 views
1

我想使用屏幕的/ dev/ttyUSB0不同的選項,例如,數據位,校驗等

屏幕的/ dev/ttyUSB0

連接到舊的計算機(S)通過一個USB串行接口。

我希望在本網站註冊我將收到我的問題的答案。我已經搜索和搜索,但還沒有想出在我的命令行中輸入正確的選項,以便從我的計算機獲得非垃圾回覆(收到的文本全部搞砸了)。

我的操作系統是CentOs,Gnome 2.16.0。 我看到有一個叫做KPPP的程序,它有一個「終端...」,但還沒有想出那個。所以我試圖使用CLI與'屏幕',但我有麻煩設置正確的參數(顯然,我不明白如何把這些參數與stty一起使用)。這不是安裝應用程序或使用此計算機執行任何操作的選項,因此我必須使用已有的內容。 「屏幕」,似乎做的工作,但收到的文字是如前面提到的(「$$ @%IDJ LDJ」等)胡言亂語

我需要這些參數的計算機之一:

波特率: 9600數據位:8奇偶校驗:否停止位:2流量控制:硬件。

對於計算機兩個I需要:

波特率:9600,數據位:7校驗位:偶停止位:1個,流量控制:硬件

波特率是容易的;

屏幕的/ dev/ttyUSB0 9600

但如何處理剩下的,我不知道。 。我已經找到了停車位的選項:

CSTOPB(使用兩個停止位)

-cstopb(使用一個停止位)

但我怎麼正確地使用它?

屏幕的/ dev/ttyUSB0 9600 -cstopb

屏幕的/ dev/ttyUSB0 9600,-cstopb

因此,如果有人可以幫助我的連接通過與所有列出的參數串行接口的其他計算機,我會非常感謝!

更新22。2016年12月:

我發現這個手冊的stty:http://osr507doc.sco.com/man/html.C/stty.C.html

是,數據位與此相同的選項?

cs5 cs6 cs7 cs8 
     Select character size (see termio(M)). 

奇偶校驗:

parodd (-parodd) 
     Select odd (even) parity. 

停止位:

cstopb (-cstopb) 
     Use two (one) stop bits per character. 

但是硬件控制呢?

反正;這仍然不起作用;

screen /dev/ttyUSB0 9600 cs8 oddp cstop 

screen /dev/ttyUSB0 9600 cs7 evenp -cstop 
+0

你試過'gtkterm'嗎?它是一個基於GUI的串行端口終端應用程序,允許您使用GUI設置端口設置。 – HeyYO

+0

我將不得不明天檢查並查看當前發行版是否安裝了gkterm!謝謝,這可能只是解決了我的問題。 –

+0

bash:gtkterm:找不到命令 –

回答

1

我不認爲屏幕支持所有這些不同的串行端口設置,只支持最基本的參數。 通過查看stty手冊,您已經在正確的方向,但是您必須使用stty作爲屏幕上的單獨工具: 首先配置串口,然後使用屏幕連接到它。

配置您的串行端口計算機1:

# stty - change and print terminal line settings 
# 
# -F /dev/ttyUSB0  Change the settings of /dev/ttyUSB0 
# cs8     Use 8 character bits 
# -parenb    Don't use a parity bit (the '-' means 'disable') 
# crtscts    Enable RTS/CTS handshaking (hardware flow control) 
stty -F /dev/ttyUSB0 cs8 -parenb cstopb crtscts 

後配置您的端口,就可以開始使用它槽屏幕:

# screen - screen manager with VT100/ANSI terminal emulation 
# 
# /dev/ttyUSB0   Use /dev/ttyUSB0 as terminal 
# 9600     Open the serial port using 9600 baud 
screen /dev/ttyUSB0 9600 

這同樣適用於你的第二臺電腦:

# stty - change and print terminal line settings 
# 
# -F /dev/ttyUSB0  Change the settings of /dev/ttyUSB0 
# cs7     Use 7 character bits 
# parenb    Enable the a parity bit 
# -parodd    Don't use ODD, but use EVEN parity 
# -cstopb    Don't use 2 stopbits, but just the regular 1 
# crtscts    Enable RTS/CTS handshaking (hardware flow control) 
stty -F /dev/ttyUSB0 cs7 parenb -parodd -cstopb crtscts 

然後你可以啓動屏幕@ 9600波特:

# screen - screen manager with VT100/ANSI terminal emulation 
# 
# /dev/ttyUSB0   Use /dev/ttyUSB0 as terminal 
# 9600     Open the serial port using 9600 baud 
screen /dev/ttyUSB0 9600 

這應該有所斬斷。你可以在stty的幫助下找到更多的配置選項:

stty --help 
+0

非常感謝,但我剛遇到一個新問題;我需要使用NOTIS終端仿真來獲取正確的信息。我唯一發現使用這個NOTIS模擬的東西是一個叫做WinLink的程序,它來自softlink.no –