From 03a48372274d2b903a15e7325265db3a1677c4a3 Mon Sep 17 00:00:00 2001 From: Home Date: Fri, 13 Aug 2021 15:00:17 -0400 Subject: [PATCH] OSX build error fixes --- ModemPort.h | 3 +++ NullController.h | 4 ++++ PseudoTTYController.cpp | 6 +++++- UARTController.cpp | 9 +++++++-- UDPController.h | 4 ++++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ModemPort.h b/ModemPort.h index c537f9e04..458911139 100644 --- a/ModemPort.h +++ b/ModemPort.h @@ -30,6 +30,9 @@ class IModemPort { virtual int write(const unsigned char* buffer, unsigned int length) = 0; virtual void close() = 0; +#if defined(__APPLE__) + virtual int setNonblock(bool nonblock) = 0; +#endif private: }; diff --git a/NullController.h b/NullController.h index 2dad99bd2..1d8da6389 100644 --- a/NullController.h +++ b/NullController.h @@ -35,6 +35,10 @@ class CNullController : public IModemPort { virtual int write(const unsigned char* buffer, unsigned int length); virtual void close(); + +#if defined(__APPLE__) + int setNonblock(bool nonblock) { return 0; } +#endif private: CRingBuffer m_buffer; diff --git a/PseudoTTYController.cpp b/PseudoTTYController.cpp index 8c3cd7ab5..120506483 100644 --- a/PseudoTTYController.cpp +++ b/PseudoTTYController.cpp @@ -32,7 +32,11 @@ #include #include #include -#include +#if defined(__APPLE__) + #include +#else + #include +#endif CPseudoTTYController::CPseudoTTYController(const std::string& symlink, unsigned int speed, bool assertRTS) : diff --git a/UARTController.cpp b/UARTController.cpp index cc748b1de..0a2d5f616 100644 --- a/UARTController.cpp +++ b/UARTController.cpp @@ -328,8 +328,13 @@ bool CUARTController::setRaw() ::cfsetispeed(&termios, B230400); break; case 460800U: - ::cfsetospeed(&termios, B460800); - ::cfsetispeed(&termios, B460800); +#if defined(__APPLE__) + ::cfsetospeed(&termios, 460800); + ::cfsetispeed(&termios, 460800); +#else + ::cfsetospeed(&termios, B460800); + ::cfsetispeed(&termios, B460800); +#endif break; default: LogError("Unsupported serial port speed - %u", m_speed); diff --git a/UDPController.h b/UDPController.h index 85ee61247..cbb547fdb 100644 --- a/UDPController.h +++ b/UDPController.h @@ -37,6 +37,10 @@ class CUDPController : public IModemPort { virtual int write(const unsigned char* buffer, unsigned int length); virtual void close(); + +#if defined(__APPLE__) + int setNonblock(bool nonblock) { return 0; } +#endif protected: CUDPSocket m_socket;