我想使用屏幕作为串行终端,但我的输出格式不正确.
我用这个命令:

sudo screen /dev/ttyACM0 9600,cs8

认为上面的配置就像9600 8N1没有奇偶校验和没有流量控制配置,我得到了这个输出:

This program runs since 135 seconds.
                                                This program runs since 136 seconds.
                                                                                    This program runs since 137 seconds.
                    This program runs since 138 seconds.
                                                        This program runs since 139 seconds.
                                                                                            This program runs since 140 seconds.
                                This program runs since 141 seconds.

在QTKTerm中我得到了相同的结果,直到我在配置菜单中设置CR LF自动模式:

This program runs since 759 seconds.
This program runs since 760 seconds.
This program runs since 761 seconds.

如何在屏幕上获得相同的结果?


谢谢你的帮助.

解决方法:

根据screen手册,在WINDOW TYPES

If a tty (character special device) name (e.g. "/dev/ttya") is specified as the first parameter, then the window is directly connected to this device. This window type is similar to "screen cu -l /dev/ttya". Read and write access is required on the device node, an exclusive open is attempted on the node to mark the connection line as busy. An optional parameter is allowed consisting of a comma separated list of flags in the notation used by ‘07002’:

它继续列出一些可能的标志,但补充说

You may want to specify as many of these options as applicable. Unspecified options cause the terminal driver to make up the parameter values of the connection. These values are system-dependent and may be in defaults or values saved from a previous connection.

查找更多信息的地方在stty手册中,因为屏幕只是将这些额外的标志传递给stty.

您可以通过添加“输出设置”下列出的onlcr标志来修复您的问题最接近的错误行为:

[-]onlcr
translate newline to carriage return-newline

例如:

sudo screen /dev/ttyACM0 9600,cs8,onlcr

标签: linux, terminal, tty

相关文章推荐

添加新评论,含*的栏目为必填