aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/e100
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2016-07-18 14:34:00 -0700
committerMartin Braun <martin.braun@ettus.com>2016-09-02 11:10:46 -0700
commit59ed6e1a0f9710c7bfca0a348d07f8c96f9f6bc0 (patch)
tree368f9aa5e9b2031beb92bc3916fa2a7bba8b372a /host/lib/usrp/e100
parent196e93a387dea47ab8a3ad600b90446e98840a54 (diff)
downloaduhd-59ed6e1a0f9710c7bfca0a348d07f8c96f9f6bc0.tar.gz
uhd-59ed6e1a0f9710c7bfca0a348d07f8c96f9f6bc0.tar.bz2
uhd-59ed6e1a0f9710c7bfca0a348d07f8c96f9f6bc0.zip
GPSDO: Make sure read_uart() returns only complete strings for all devices.
Diffstat (limited to 'host/lib/usrp/e100')
-rw-r--r--host/lib/usrp/e100/e100_ctrl.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/host/lib/usrp/e100/e100_ctrl.cpp b/host/lib/usrp/e100/e100_ctrl.cpp
index cdbbff6dd..3b59a93e1 100644
--- a/host/lib/usrp/e100/e100_ctrl.cpp
+++ b/host/lib/usrp/e100/e100_ctrl.cpp
@@ -232,10 +232,15 @@ public:
//got a character -> process it
if (ret == 1){
- const bool flush = ch == '\n' or ch == '\r';
- if (flush and line.empty()) continue; //avoid flushing on empty lines
- line += std::string(1, ch);
- if (flush) break;
+ if (ch == '\r') continue;
+ if (ch == '\n' and _line.empty()) continue;
+ _line += ch;
+ if (ch == '\n')
+ {
+ line = _line;
+ _line.clear();
+ break;
+ }
}
//didnt get a character, check the timeout
@@ -251,7 +256,9 @@ public:
return line;
}
-private: int _node_fd;
+private:
+ int _node_fd;
+ std::string _line;
};
uhd::uart_iface::sptr e100_ctrl::make_gps_uart_iface(const std::string &node){