3

I know:

Nowadays, when we logon linux, either desktop or by ssh remote, the linux system allocates a pseudo terminal under /dev/pty for us, right?

My question:

So some unix functions which is used to set baud rate: seems they're for real physical devices, are they still effective for pseudo terminals?

Hind Forsum
  • 9,717
  • 13
  • 63
  • 119

2 Answers2

2

The baud rate setting for a pseudo-terminal doesn't control anything, but advises the terminal driver (when it matters) how to synchronize with a physical device, as well as advising applications if they should send padding characters.

A pseudo-terminal might be connected to a physical device, but there's no way for an application to tell the difference. Physical devices are still used (perhaps not by you).

For example, xterm has an option, used for testing ncurses:

Patch #327 - 2016/10/07
add -baudrate option, for testing ncurses.

but you would not find it useful.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
1

The baud rate is ignored for pseudo terminals. It is possible to set any baud rate the driver remembers it but it does not use it for any action:

# stty speed
38400
# stty speed 1200
# stty speed
1200

It looks the speed is set but it has no effect to pseudo terminal driver. It has effect only if the terminal driver is connected to UART.

Zaboj Campula
  • 3,155
  • 3
  • 24
  • 42