diff options
author | Josh Blum <josh@joshknows.com> | 2010-04-22 18:20:29 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-04-22 18:20:29 -0700 |
commit | 8887da1b1532ad527131c4f661158f751f3cbeaf (patch) | |
tree | 484c8a0f5eff039d8682494b3ee75a706f640bf3 /host/lib/usrp/usrp2/usrp2_iface.cpp | |
parent | 3551ef506737576d15b86b151bce3ae225d36092 (diff) | |
parent | e5248746f66829c0bd899bcde5c15970fdda785d (diff) | |
download | uhd-8887da1b1532ad527131c4f661158f751f3cbeaf.tar.gz uhd-8887da1b1532ad527131c4f661158f751f3cbeaf.tar.bz2 uhd-8887da1b1532ad527131c4f661158f751f3cbeaf.zip |
Merge branch 'master' of git@ettus.sourcerepo.com:ettus/uhdpriv into xcvr
Diffstat (limited to 'host/lib/usrp/usrp2/usrp2_iface.cpp')
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 742c53a14..1b0dde1b4 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -97,6 +97,7 @@ public: //fill in the seq number and send usrp2_ctrl_data_t out_copy = out_data; + out_copy.proto_ver = htonl(USRP2_PROTO_VERSION); out_copy.seq = htonl(++_ctrl_seq_num); _ctrl_transport->send(boost::asio::buffer(&out_copy, sizeof(usrp2_ctrl_data_t))); @@ -104,6 +105,13 @@ public: while(true){ usrp2_ctrl_data_t in_data; size_t len = _ctrl_transport->recv(boost::asio::buffer(&in_data, sizeof(in_data))); + if(len >= sizeof(boost::uint32_t) and ntohl(in_data.proto_ver) != USRP2_PROTO_VERSION){ + throw std::runtime_error(str( + boost::format("Expected protocol version %d, but got %d\n" + "The firmware build does not match the host code build." + ) % int(USRP2_PROTO_VERSION) % ntohl(in_data.proto_ver) + )); + } if (len >= sizeof(usrp2_ctrl_data_t) and ntohl(in_data.seq) == _ctrl_seq_num){ return in_data; } |