From 7ec60552878a90394fda3dbe2368fe7ef66e0067 Mon Sep 17 00:00:00 2001 From: Rhys Mainwaring Date: Sat, 19 Aug 2023 10:24:51 +0100 Subject: [PATCH] Enable termios baudrate configuration for macOS - termios.h on macOS does not define the macro _HAVE_STRUCT_TERMIOS_C_ISPEED. Signed-off-by: Rhys Mainwaring --- include/uxr/agent/utils/ArgumentParser.hpp | 4 ++-- src/cpp/transport/serial/MultiTermiosAgentLinux.cpp | 4 ++-- src/cpp/transport/serial/TermiosAgentLinux.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/uxr/agent/utils/ArgumentParser.hpp b/include/uxr/agent/utils/ArgumentParser.hpp index fc6d7795..01ff0098 100644 --- a/include/uxr/agent/utils/ArgumentParser.hpp +++ b/include/uxr/agent/utils/ArgumentParser.hpp @@ -1068,10 +1068,10 @@ class ArgumentParser /* Setting baudrate. */ speed_t baudrate = getBaudRate(baudrate_str); -#if _HAVE_STRUCT_TERMIOS_C_ISPEED +#if _HAVE_STRUCT_TERMIOS_C_ISPEED || __APPLE__ attr.c_ispeed = baudrate; #endif -#if _HAVE_STRUCT_TERMIOS_C_OSPEED +#if _HAVE_STRUCT_TERMIOS_C_OSPEED || __APPLE__ attr.c_ospeed = baudrate; #endif diff --git a/src/cpp/transport/serial/MultiTermiosAgentLinux.cpp b/src/cpp/transport/serial/MultiTermiosAgentLinux.cpp index a11d7486..70bd1f2f 100644 --- a/src/cpp/transport/serial/MultiTermiosAgentLinux.cpp +++ b/src/cpp/transport/serial/MultiTermiosAgentLinux.cpp @@ -85,10 +85,10 @@ void MultiTermiosAgent::init_multiport() new_attrs.c_cc[VMIN] = termios_attrs_.c_cc[VMIN]; new_attrs.c_cc[VTIME] = termios_attrs_.c_cc[VTIME]; -#if _HAVE_STRUCT_TERMIOS_C_ISPEED +#if _HAVE_STRUCT_TERMIOS_C_ISPEED || __APPLE__ cfsetispeed(&new_attrs, termios_attrs_.c_ispeed); #endif -#if _HAVE_STRUCT_TERMIOS_C_OSPEED +#if _HAVE_STRUCT_TERMIOS_C_OSPEED || __APPLE__ cfsetospeed(&new_attrs, termios_attrs_.c_ospeed); #endif diff --git a/src/cpp/transport/serial/TermiosAgentLinux.cpp b/src/cpp/transport/serial/TermiosAgentLinux.cpp index 4d8dd0e0..fab89a5a 100644 --- a/src/cpp/transport/serial/TermiosAgentLinux.cpp +++ b/src/cpp/transport/serial/TermiosAgentLinux.cpp @@ -102,10 +102,10 @@ bool TermiosAgent::init() new_attrs.c_cc[VMIN] = termios_attrs_.c_cc[VMIN]; new_attrs.c_cc[VTIME] = termios_attrs_.c_cc[VTIME]; -#if _HAVE_STRUCT_TERMIOS_C_ISPEED +#if _HAVE_STRUCT_TERMIOS_C_ISPEED || __APPLE__ cfsetispeed(&new_attrs, termios_attrs_.c_ispeed); #endif -#if _HAVE_STRUCT_TERMIOS_C_OSPEED +#if _HAVE_STRUCT_TERMIOS_C_OSPEED || __APPLE__ cfsetospeed(&new_attrs, termios_attrs_.c_ospeed); #endif