forked from dcuddeback/serial-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The termios2 struct with TCSETS2/TCGETS2 ioctls is the modern way to set arbitrary baud rates on Linux. This commit does *not* implement custom baud rates (dcuddeback#49), but lays the groundwork for doing so by replacing the POSIX termios API with the Linux-specific termios2 API when Linux is the compilation target. Since this is an alternative to the termios(3) API, it was necessary to manually modify baud rates in c_cflags, c_ospeed, and c_ispeed members of termios2 in order to implement replacements for cfsetspeed(), cfgetispeed(), and cfgetospeed(). Helpful documentation can be found in Picocom's writeup of termios2 [1] and drivers/tty/tty_baudrate.c from the Linux kernel source [2]. No behavior should change due to this commit. The termios2 struct was added to libc in v0.2.33. [1]: https://github.com/npat-efault/picocom/blob/1acf1ddabaf3576b4023c4f6f09c5a3e4b086fb8/termios2.txt [2]: https://github.com/torvalds/linux/blob/ba4dbdedd3edc2798659bcd8b1a184ea8bdd04dc/drivers/tty/tty_baudrate.c#L49-L121
- Loading branch information
1 parent
5fe2a1b
commit 4587b89
Showing
2 changed files
with
126 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters