diff options
author | Josh Blum <josh@joshknows.com> | 2011-09-28 13:10:30 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-09-28 13:10:30 -0700 |
commit | 1e6136ad70acc33122d4498b86cb8fc39cc2dcb9 (patch) | |
tree | 28a90e59d741fcee284aefa16396924282223526 /host/lib/usrp/e100/e100_ctrl.cpp | |
parent | 5098256a258623b2d0bb6aa54b923f22e92a178f (diff) | |
download | uhd-1e6136ad70acc33122d4498b86cb8fc39cc2dcb9.tar.gz uhd-1e6136ad70acc33122d4498b86cb8fc39cc2dcb9.tar.bz2 uhd-1e6136ad70acc33122d4498b86cb8fc39cc2dcb9.zip |
e100: gps uart deal with cr and nl
Diffstat (limited to 'host/lib/usrp/e100/e100_ctrl.cpp')
-rw-r--r-- | host/lib/usrp/e100/e100_ctrl.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/host/lib/usrp/e100/e100_ctrl.cpp b/host/lib/usrp/e100/e100_ctrl.cpp index 028e734e3..18eefb023 100644 --- a/host/lib/usrp/e100/e100_ctrl.cpp +++ b/host/lib/usrp/e100/e100_ctrl.cpp @@ -191,8 +191,8 @@ public: //init the tty settings w/ termios termios tio; std::memset(&tio,0,sizeof(tio)); - tio.c_iflag=0; - tio.c_oflag=0; + tio.c_iflag = IGNCR; //Ignore CR + tio.c_oflag = ONLCR; //Map NL to CR-NL on output tio.c_cflag=CS8|CREAD|CLOCAL; // 8n1, see termios.h for more information tio.c_lflag=0; tio.c_cc[VMIN]=1; @@ -205,13 +205,8 @@ public: } void write_uart(const std::string &buf){ - std::string out_str; - BOOST_FOREACH(const char &ch, buf){ - if (ch == '\n') out_str += "\r\n"; - else out_str += std::string(1, ch); - } - const ssize_t ret = ::write(_node_fd, out_str.c_str(), out_str.size()); - if (size_t(ret) != out_str.size()) UHD_LOG << ret; + const ssize_t ret = ::write(_node_fd, buf.c_str(), buf.size()); + if (size_t(ret) != buf.size()) UHD_LOG << ret; } std::string read_uart(double timeout){ |