UartComIF: set O_NONBLOCK in canonical mode
When using the non-canonical mode, the file descriptor can be opened in blocking mode because the VTIME and VMIN termios parameters are used to configure non-blocking mode. However, in canonical mode, the fd needs to be opened with O_NONBLOCK
This commit is contained in:
parent
7d0377845b
commit
5454169e20
@ -60,7 +60,13 @@ int UartComIF::configureUartPort(UartCookie* uartCookie) {
|
|||||||
struct termios options = {};
|
struct termios options = {};
|
||||||
|
|
||||||
std::string deviceFile = uartCookie->getDeviceFile();
|
std::string deviceFile = uartCookie->getDeviceFile();
|
||||||
int fd = open(deviceFile.c_str(), O_RDWR);
|
int flags = O_RDWR;
|
||||||
|
if(uartCookie->getUartMode() == UartModes::CANONICAL) {
|
||||||
|
// In non-canonical mode, don't specify O_NONBLOCK because these properties will be
|
||||||
|
// controlled by the VTIME and VMIN parameters and O_NONBLOCK would override this
|
||||||
|
flags |= O_NONBLOCK;
|
||||||
|
}
|
||||||
|
int fd = open(deviceFile.c_str(), flags);
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
sif::warning << "UartComIF::configureUartPort: Failed to open uart " << deviceFile <<
|
sif::warning << "UartComIF::configureUartPort: Failed to open uart " << deviceFile <<
|
||||||
|
Loading…
x
Reference in New Issue
Block a user