-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/native/periph/uart: uart_poweroff() closes the file descriptor + extended baud-rate support on Linux #20365
Conversation
437df91
to
795415d
Compare
On a second glance, it looks that some baudrates already included (e.g. 115200) are not POSIX either, so I think I should enable them all uncoditionally. |
if (res < 0) { | ||
err(EXIT_FAILURE, "native_async_read_remove_handler(): fcntl(F_GETFL)"); | ||
} | ||
unsigned flags = (unsigned)res & !O_ASYNC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that be ~O_ASYNC
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, yes, ~O_ASYNC
. Why was this merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice it 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha ok I'll fix is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry, shit happens 😉
Contribution description
uart_poweroff()
now closes the underlying file descriptorThis is needed if for re-initializing the UART device. An example use-case is baud-rate probing.
On Linux, extended baud-rate support
On Linux, the extended baud-rates are defined in
bits/termios-baud.h
as follows:As such, I'm not sure if they are available on other platforms too, so I enabled them for Linux only.
Testing procedure
The following should be a valid use-case: