Skip to content

Commit

Permalink
LinuxSerialDriver: Check for errors when setting interface speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua-Anderson authored and LeStarch committed Aug 31, 2021
1 parent da3bd77 commit 5cb1e2e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Drv/LinuxSerialDriver/LinuxSerialDriverComponentImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,23 @@ namespace Drv {

// Set baud rate:
stat = cfsetispeed(&newtio, relayRate);
if (stat) {
DEBUG_PRINT("cfsetispeed failed\n");
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_DR_OpenError(_arg,fd,_err);
return false;
}
stat = cfsetospeed(&newtio, relayRate);
if (stat) {
DEBUG_PRINT("cfsetospeed failed\n");
close(fd);
Fw::LogStringArg _arg = device;
Fw::LogStringArg _err = strerror(errno);
this->log_WARNING_HI_DR_OpenError(_arg,fd,_err);
return false;
}

// Raw output:
newtio.c_oflag = 0;
Expand Down

0 comments on commit 5cb1e2e

Please sign in to comment.