Skip to content

Commit

Permalink
Merge pull request crayzeewulf#185 from crayzeewulf/linux_encapsulation
Browse files Browse the repository at this point in the history
Add additional linux specific encapsulation.
  • Loading branch information
mcsauder authored Sep 8, 2023
2 parents c1e51ab + b9280ce commit ee1992d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/SerialPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@
#include <cstdlib>
#include <cstring>
#include <fcntl.h>
#include <linux/serial.h>
#include <sstream>
#include <sys/ioctl.h>
#include <type_traits>
#include <unistd.h>

#ifdef __linux__
#include <linux/serial.h>
#endif

namespace LibSerial
{
/**
Expand Down Expand Up @@ -2106,7 +2109,9 @@ namespace LibSerial

// @NOTE - termios.c_line is not a standard element of the termios
// structure, (as per the Single Unix Specification 3).
port_settings.c_line = '\0' ;
#ifdef __linux__
port_settings.c_line = '\0' ;
#endif

// Apply the modified settings.
if (tcsetattr(this->mFileDescriptor,
Expand Down
2 changes: 2 additions & 0 deletions src/SerialStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@ namespace LibSerial
throw ;
}

#ifdef __linux__
std::vector<std::string>
SerialStream::GetAvailableSerialPorts()
try
Expand All @@ -932,4 +933,5 @@ namespace LibSerial
setstate(std::ios_base::failbit) ;
throw ;
}
#endif
} // namespace LibSerial
1 change: 0 additions & 1 deletion src/SerialStreamBuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <cassert>
#include <cstring>
#include <fcntl.h>
#include <linux/serial.h>
#include <sys/ioctl.h>
#include <unistd.h>

Expand Down

0 comments on commit ee1992d

Please sign in to comment.