如何在PuTTY串行通信中仅在按回车时发送字符?

发布于 2024-10-17 04:42:07 字数 313 浏览 6 评论 0原文

我正在尝试使用 PuTTY 通过计算机的串行线路进行通信。我已经配置了正确的串行线路、波特率、数据位数、停止位、奇偶校验和流量控制,并建立了连接。当我单击“确定”打开连接时,我会看到黑屏,并且每次按键都会发送,但不会显示在屏幕上(窗口保持黑色)。如何配置 PuTTY,使其仅在我按 Enter 键后发送我的命令或操作码?

我在大学时使用 PuTTY 进行 Telnet / SSH,它总是显示我的命令,并且只有在我按下 Enter 键后才输入它们,所以我有点困惑。

I am trying to use PuTTY to communicate over my computer's serial line. I have configured the correct serial line, baud rate, number of data bits, stop bits, parity, and flow control, and established the connection. When I click OK to open the connection, I am shown a black screen and each of my key presses are sent without being shown on the screen (the window remains black). How do I configure PuTTY so that it only sends my commands or opcodes after I press enter?

I have used PuTTY while at college for Telnet / SSH and it always showed my commands and input them only after I pressed the enter key, so I am a bit confused.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花想c 2024-10-24 04:42:07

您需要的设置是左侧“终端”类别下的“本地回显”“行编辑”

要让字符在输入时显示在屏幕上,请将“本地回显”设置为“强制启用”

要让终端在按 Enter 之前不发送命令,请将“本地行编辑”设置为“强制启用”

PuTTY 线路规则options

说明:

来自 PuTTY 用户手册(通过单击 PuTTY 中的“帮助”按钮找到):

4.3.8“本地回声”

禁用本地回显后,PuTTY 不会在窗口中回显您在 PuTTY 窗口中输入的字符。它们只是被发送到服务器。 (服务器可能会选择将它们回显给您;这无法通过 PuTTY 控制面板进行控制。)

某些类型的会话需要本地回显,而许多类型则不需要。在默认模式下,PuTTY 将自动尝试推断本地回显是否适合您正在使用的会话。如果您发现它做出了错误的决定,您可以使用此配置选项来覆盖其选择:您可以强制本地回显打开,或强制关闭,而不是依赖自动检测。

4.3.9“本地线路编辑”
通常,您在 PuTTY 窗口中输入的每个字符都会在您输入时立即发送到服务器。

如果您启用本地行编辑,情况会发生变化。 PuTTY 允许您在本地一次编辑一整行,并且只有当您按回车键时,该行才会发送到服务器。如果您犯了错误,您可以在按 Return 之前使用 Backspace 键更正它,并且服务器永远不会发现该错误。

由于很难在本地编辑一行而看不到它,因此本地行编辑主要与本地回显结合使用(第 4.3.8 节)。这使得它非常适合在原始模式下使用或连接到 MUD 或扬声器时。 (尽管一些更高级的 MUD 偶尔会打开本地行编辑并关闭本地回显,以便接受用户的密码。)

某些类型的会话需要本地行编辑,而许多则不需要。在默认模式下,PuTTY 将自动尝试推断本地行编辑是否适合您正在使用的会话。如果您发现它做出了错误的决定,您可以使用此配置选项来覆盖其选择:您可以强制打开或关闭本地行编辑,而不是依赖自动检测。

当为这些选项启用“自动”时,Putty 有时会做出错误的选择,因为它会尝试检测连接配置。应用于串行线,这有点棘手。

The settings you need are "Local echo" and "Line editing" under the "Terminal" category on the left.

To get the characters to display on the screen as you enter them, set "Local echo" to "Force on".

To get the terminal to not send the command until you press Enter, set "Local line editing" to "Force on".

PuTTY Line discipline options

Explanation:

From the PuTTY User Manual (Found by clicking on the "Help" button in PuTTY):

4.3.8 ‘Local echo’

With local echo disabled, characters you type into the PuTTY window are not echoed in the window by PuTTY. They are simply sent to the server. (The server might choose to echo them back to you; this can't be controlled from the PuTTY control panel.)

Some types of session need local echo, and many do not. In its default mode, PuTTY will automatically attempt to deduce whether or not local echo is appropriate for the session you are working in. If you find it has made the wrong decision, you can use this configuration option to override its choice: you can force local echo to be turned on, or force it to be turned off, instead of relying on the automatic detection.

4.3.9 ‘Local line editing’
Normally, every character you type into the PuTTY window is sent immediately to the server the moment you type it.

If you enable local line editing, this changes. PuTTY will let you edit a whole line at a time locally, and the line will only be sent to the server when you press Return. If you make a mistake, you can use the Backspace key to correct it before you press Return, and the server will never see the mistake.

Since it is hard to edit a line locally without being able to see it, local line editing is mostly used in conjunction with local echo (section 4.3.8). This makes it ideal for use in raw mode or when connecting to MUDs or talkers. (Although some more advanced MUDs do occasionally turn local line editing on and turn local echo off, in order to accept a password from the user.)

Some types of session need local line editing, and many do not. In its default mode, PuTTY will automatically attempt to deduce whether or not local line editing is appropriate for the session you are working in. If you find it has made the wrong decision, you can use this configuration option to override its choice: you can force local line editing to be turned on, or force it to be turned off, instead of relying on the automatic detection.

Putty sometimes makes wrong choices when "Auto" is enabled for these options because it tries to detect the connection configuration. Applied to serial line, this is a bit trickier to do.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文