From 59ed6e1a0f9710c7bfca0a348d07f8c96f9f6bc0 Mon Sep 17 00:00:00 2001 From: michael-west Date: Mon, 18 Jul 2016 14:34:00 -0700 Subject: GPSDO: Make sure read_uart() returns only complete strings for all devices. --- host/lib/usrp/x300/x300_fw_uart.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'host/lib/usrp/x300') diff --git a/host/lib/usrp/x300/x300_fw_uart.cpp b/host/lib/usrp/x300/x300_fw_uart.cpp index b0fae124d..86141ca9a 100644 --- a/host/lib/usrp/x300/x300_fw_uart.cpp +++ b/host/lib/usrp/x300/x300_fw_uart.cpp @@ -132,6 +132,10 @@ struct x300_uart_iface : uart_iface if (ch == '\r') continue; + // avoid returning empty strings + if (ch == '\n' and _rxbuff.empty()) + continue; + // store character to buffer _rxbuff += std::string(1, (char)ch); -- cgit v1.2.3