哪些 termios 设置会导致端点出现乱码串行?

哪些 termios 设置会导致端点出现乱码串行?

我有两个端点。一个是Windows Subsystem for Linux (Ubuntu),另一个是小型AR9331路由器(运行OpenWRT并具有16550芯片)。它们通过 USB 转串行连接进行连接。

从 AR9331 发送到 WSL 按预期工作。

WSL 控制台:

~/openwrt_master$ cat /dev/ttyS5

HELLOTOALL

HELLOTOALL

HELLOTOALL

AR9331控制台:

root@OpenWrt:~# echo "HELLOTOALL" > /dev/ttyATH0
root@OpenWrt:~# echo "HELLOTOALL" > /dev/ttyATH0
root@OpenWrt:~# echo "HELLOTOALL" > /dev/ttyATH0

从 WSL 发送到 AR9331 无法按预期工作,出现乱码或乱序。

WSL 控制台:

~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5
~/openwrt_master$ echo "ILIKECHICKEN" > /dev/ttyS5

AR9331控制台:

ILIKECHICKEN

IKECHICKEN

ILIKECHICKEN

I

ILIKECHICKEN

I

ILIKECHICKEN

I

ILIKECHICKEN

IKECHICKEN

ILIKECHICKEN

AR9331 TTY设置:

root@OpenWrt:~# stty -F /dev/ttyATH0 -a
speed 115200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke -flusho -extproc

WSL TTY 设置:

~/openwrt_master$ stty -F /dev/ttyS5 -a
speed 115200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = <undef>; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

我尝试搞乱规范模式,但它似乎没有改变任何东西。

相关内容