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

Make c_ispeed and c_ospeed public. #8

Closed
wants to merge 1 commit into from

Conversation

mbr
Copy link

@mbr mbr commented Mar 3, 2017

Access to these fields is important when setting custom transmission
rates; make them accessible for other libraries.

This PR is in anticipation of a new feature for serial-rs, allowing custom bitrates to be set.

Access to these fields is important when setting custom transmission
rates; make them accessible for other libraries.
@dcuddeback
Copy link
Owner

@mbr These fields are not part of the POSIX spec, but cf{set,get}{i,o}speed() are, which is a portable way to set and get the baud rates.

@dcuddeback dcuddeback closed this Mar 5, 2017
@mbr
Copy link
Author

mbr commented Mar 5, 2017

@dcuddeback How do i set a bitrate of 12345 baud?

cfsetospeed() sets the output baud rate stored in the termios structure pointed to by
termios_p to speed, which must be one of these constants:

[...]

I don't think it's possible to set a nonstandard speed this way (that does not have a constant defined).

cfsetispeed is limited to the struct termios structure, which does not carry these fields. What termios-rs labels pub struct termios is actually a struct termios2 (see link for a comparison). The C struct termios does not carry the c_ispeed/c_outspeed fields, for this reason, non-standard bitrates cannot be stored in it.

This was referenced Mar 5, 2017
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

Successfully merging this pull request may close these issues.

2 participants