Skip to content

Commit

Permalink
Enable termios baudrate configuration for macOS
Browse files Browse the repository at this point in the history
- termios.h on macOS does not define the macro _HAVE_STRUCT_TERMIOS_C_ISPEED.

Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Aug 19, 2023
1 parent 40954c2 commit 666361c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/uxr/agent/utils/ArgumentParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/cpp/transport/serial/MultiTermiosAgentLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/cpp/transport/serial/TermiosAgentLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 666361c

Please sign in to comment.