From 5ab3f053529bb8d85a7f1ba9e1dd113c1f6eb813 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Fri, 13 Aug 2010 13:07:56 -0700 Subject: GPS interface works for Jackson Labs devices. --- host/lib/usrp/usrp2/gps_ctrl.cpp | 4 +++- host/lib/usrp/usrp2/usrp2_iface.cpp | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'host/lib/usrp/usrp2') diff --git a/host/lib/usrp/usrp2/gps_ctrl.cpp b/host/lib/usrp/usrp2/gps_ctrl.cpp index 5c015be14..7152800aa 100644 --- a/host/lib/usrp/usrp2/gps_ctrl.cpp +++ b/host/lib/usrp/usrp2/gps_ctrl.cpp @@ -42,9 +42,10 @@ public: //TODO: try multiple baud rates (many GPS's are set up for 4800bps, you're fixed at 115200bps 8N1 right now) //you have to poke registers in order to set baud rate, there's no dude/bro interface for it - _iface->write_uart(GPS_UART, "HAAAY GUYYYYS\n"); + _iface->write_uart(GPS_UART, "HAAAY GUYYYYS\n"); try { reply = _iface->read_uart(GPS_UART, 20); + //std::cerr << "Got reply from GPS: " << reply.c_str() << " with length = " << reply.length() << std::endl; } catch (std::runtime_error err) { if(err.what() != std::string("usrp2 no control response")) throw; //sorry can't cope with that else { //we don't actually have a GPS installed @@ -57,6 +58,7 @@ public: switch(gps_type) { case GPS_TYPE_JACKSON_LABS: + std::cerr << "Found a Jackson Labs GPS" << std::endl; //issue some setup stuff so it quits spewing data out when not asked to //none of these should issue replies so we don't bother looking for it _iface->write_uart(GPS_UART, "SYST:COMM:SER:"); diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 04b3b1e74..f4d354204 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -208,8 +208,7 @@ public: UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_I_HELLA_READ_THAT_UART_DUDE); //copy out the data - std::string result; - std::copy(in_data.data.uart_args.data, in_data.data.uart_args.data + num_bytes, result.begin()); + std::string result((const char *)in_data.data.uart_args.data, (size_t)in_data.data.uart_args.bytes); return result; } -- cgit v1.2.3