]> git.ipfire.org Git - thirdparty/man-pages.git/commit
ioctl_tty.2: Add example how to get or set baudrate on the serial port
authorPali Rohár <pali@kernel.org>
Tue, 10 Aug 2021 19:49:28 +0000 (21:49 +0200)
committerAlejandro Colomar <alx.manpages@gmail.com>
Fri, 10 Sep 2021 13:30:41 +0000 (15:30 +0200)
commitf528e587fb36af312152e524513df828612c4095
tree6ab42fa29c7b493e4c32c9cd07ad18338655e029
parent624faf01d0ac9becd7f9bc0e344d1c5f211302d1
ioctl_tty.2: Add example how to get or set baudrate on the serial port

Setting custom baudrate for which is not defined Bnnn constant is possible
via BOTHER flag and then filling speed in c_ospeed and c_ispeed fields.

These two fields are either in struct termios or struct termios2. Former
belongs to TCGETS/TCSETS ioctls, latter to TCGETS2/TCSETS2 ioctls.

BOTHER flag with these two fields and new struct termios2 is not supported
by older versions of include header files.

Some architectures (e.g. amd64) provide both struct termios and struct
termios2, but c_ospeed and c_ispeed are only in struct termios2.

Some other architectures (e.g. alpha) provide both struct termios and struct
termios2 and both have c_ospeed and c_ispeed fields.

And some other architectures (e.g. powerpc) provide only struct termios
(no struct termios2) and it has c_ospeed and c_ispeed fields.

So basically to support all architectures it is needed to use
struct termios2 when TCGETS2/TCSETS2 is supported. Otherwise it is needed
to use struct termios with TCGETS/TCSETS (case for e.g. powerpc).

Setting input baudrate is done via IBSHIFT macro.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
man2/ioctl_tty.2