From 36b5a3be9877e581bae77a5f99c622c11f062d42 Mon Sep 17 00:00:00 2001 From: Steve Karg Date: Fri, 23 Aug 2024 17:50:30 -0500 Subject: [PATCH] Fixed MacOS specific usage during FreeBSD 11.4 build (#745) * Fixed path of exports header in BSD ports. * Fixed MacOS specific include in BSD ports. * Fixed MacOS specific IOSSIOSPEED and IOSSDATALAT usage in BSD ports --- ports/bsd/rs485.c | 10 +++++++++- ports/bsd/rs485.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ports/bsd/rs485.c b/ports/bsd/rs485.c index 555ebb8f..c502710e 100644 --- a/ports/bsd/rs485.c +++ b/ports/bsd/rs485.c @@ -42,8 +42,11 @@ #include "dlmstp_bsd.h" -/*macOS-darwin includes*/ +#if defined(__APPLE__) || defined(__darwin__) #include +#else +#include +#endif /* Posix serial programming reference: https://www.msweet.org/serial/serial.html @@ -716,6 +719,8 @@ static int openSerialPort(const char *const bsdPath) options.c_cflag &= ~CSTOPB; /* 1 Stop Bit */ options.c_cflag &= ~CSIZE; options.c_cflag |= CS8; /* Use 8 bit words */ + +#if defined(__APPLE__) || defined(__darwin__) /* The IOSSIOSPEED ioctl can be used to set arbitrary baud rates other than * those specified by POSIX. The driver for the underlying serial hardware * ultimately determines which baud rates can be used. This ioctl sets both @@ -726,6 +731,7 @@ static int openSerialPort(const char *const bsdPath) printf("Error calling ioctl(..., IOSSIOSPEED, ...) %s - %s(%d).\n", bsdPath, strerror(errno), errno); } +#endif /* Print the new input and output baud rates. Note that the IOSSIOSPEED ioctl interacts with the serial driver directly, bypassing the termios @@ -778,6 +784,7 @@ static int openSerialPort(const char *const bsdPath) printf("Handshake lines currently set to %d\n", handshake); +#if defined(__APPLE__) || defined(__darwin__) unsigned long mics = 1UL; /* Set the receive latency in microseconds. Serial drivers use this value to @@ -793,6 +800,7 @@ static int openSerialPort(const char *const bsdPath) strerror(errno), errno); goto error; } +#endif /* Success */ return fileDescriptor; diff --git a/ports/bsd/rs485.h b/ports/bsd/rs485.h index 47d55ae1..7af9f02c 100644 --- a/ports/bsd/rs485.h +++ b/ports/bsd/rs485.h @@ -12,7 +12,7 @@ #define RS485_H #include -#include "bacnet/bacnet_stack_exports.h" +#include "bacnet/basic/sys/bacnet_stack_exports.h" #include "bacnet/datalink/mstp.h" #ifdef __cplusplus