Skip to content

Commit

Permalink
Set serial port to raw mode, needed for Boost versions < 1.66.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikmohta committed Feb 8, 2018
1 parent 85f46e5 commit 694268c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ublox_gps/src/gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
//==============================================================================

#include <ublox_gps/gps.h>
#include <boost/version.hpp>

namespace ublox_gps {

Expand Down Expand Up @@ -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<Worker>(
Expand Down

1 comment on commit 694268c

@benjaminsamsonnettr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please suggest how to run the application
roslaunch launch/ublox_device.launch node_name = ?

Please sign in to comment.