From 694268c3b42434eb9a9102eaaa17f57bc444a310 Mon Sep 17 00:00:00 2001 From: Kartik Mohta Date: Thu, 8 Feb 2018 15:06:14 -0500 Subject: [PATCH] Set serial port to raw mode, needed for Boost versions < 1.66.0 --- ublox_gps/src/gps.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ublox_gps/src/gps.cpp b/ublox_gps/src/gps.cpp index 5eda8e61..344e0903 100644 --- a/ublox_gps/src/gps.cpp +++ b/ublox_gps/src/gps.cpp @@ -28,6 +28,7 @@ //============================================================================== #include +#include namespace ublox_gps { @@ -116,6 +117,18 @@ void Gps::initializeSerial(std::string port, unsigned int baudrate, ROS_INFO("U-Blox: Opened serial port %s", port.c_str()); + if(BOOST_VERSION < 106600) + { + // NOTE(Kartik): Set serial port to "raw" mode. This is done in Boost but + // until v1.66.0 there was a bug which didn't enable the relevant code, + // fixed by commit: https://github.com/boostorg/asio/commit/619cea4356 + int fd = serial->native_handle(); + termios tio; + tcgetattr(fd, &tio); + cfmakeraw(&tio); + tcsetattr(fd, TCSANOW, &tio); + } + // Set the I/O worker if (worker_) return; setWorker(boost::shared_ptr(