Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide baud constants for cfsetispeed and family #514

Closed
berkowski opened this issue Feb 16, 2017 · 2 comments
Closed

Provide baud constants for cfsetispeed and family #514

berkowski opened this issue Feb 16, 2017 · 2 comments

Comments

@berkowski
Copy link
Contributor

cfgetospeed, cfgetispeed, cfsetospeed, and cfsetispeed all work with the type speed_t, which is aliased to c_uint.

However the baud speeds are not their numerical value but system-defined constants. For example, 9600 on linux is defined as B9600 = 15.

Knowing what these constants are defined as on the target system is required to use these functions, but nix provides none and renders these functions unusable without knowledge from outside the crate.

nix should either provide aptly named speed_t constants that can be used with the baud related functions or an enum type that maps to valid values of size_t.

@posborne
Copy link
Member

Hey @berkowski. We would definitely prefer to have an enum that matches to the right constants. Would you be willing to put together a PR for this?

@berkowski
Copy link
Contributor Author

Sure, no problem.

homu added a commit that referenced this issue Feb 25, 2017
Added BaudRate enum for termios

Issue #514

Does not provide `BaudRate::EXTA` or `BaudRate::EXTB` constants. These seem to alias to `B19200` and `B38400` respectively and so break the 1:1 mapping needed by `From`.  I don't know their historic use.
homu added a commit that referenced this issue Feb 25, 2017
Added BaudRate enum for termios

Issue #514

Does not provide `BaudRate::EXTA` or `BaudRate::EXTB` constants. These seem to alias to `B19200` and `B38400` respectively and so break the 1:1 mapping needed by `From`.  I don't know their historic use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants