diff options
-rw-r--r-- | host/include/uhd/transport/udp_simple.hpp | 5 | ||||
-rw-r--r-- | host/lib/transport/udp_simple.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_fw_ctrl.cpp | 16 |
3 files changed, 23 insertions, 2 deletions
diff --git a/host/include/uhd/transport/udp_simple.hpp b/host/include/uhd/transport/udp_simple.hpp index c159a95e3..d0f6f36b1 100644 --- a/host/include/uhd/transport/udp_simple.hpp +++ b/host/include/uhd/transport/udp_simple.hpp @@ -93,6 +93,11 @@ public: * Only use this with the broadcast socket. */ virtual std::string get_recv_addr(void) = 0; + + /*! + * Get the IP address for the destination + */ + virtual std::string get_send_addr(void) = 0; }; }} //namespace diff --git a/host/lib/transport/udp_simple.cpp b/host/lib/transport/udp_simple.cpp index 9fe285376..75862d1a9 100644 --- a/host/lib/transport/udp_simple.cpp +++ b/host/lib/transport/udp_simple.cpp @@ -64,6 +64,10 @@ public: return _recv_endpoint.address().to_string(); } + std::string get_send_addr(void){ + return _send_endpoint.address().to_string(); + } + private: bool _connected; asio::io_service _io_service; diff --git a/host/lib/usrp/x300/x300_fw_ctrl.cpp b/host/lib/usrp/x300/x300_fw_ctrl.cpp index 5ff40c966..38b7eb139 100644 --- a/host/lib/usrp/x300/x300_fw_ctrl.cpp +++ b/host/lib/usrp/x300/x300_fw_ctrl.cpp @@ -28,6 +28,7 @@ #include "x300_regs.hpp" #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/thread/thread.hpp> +#include <boost/lexical_cast.hpp> using namespace uhd; using namespace uhd::niusrprio; @@ -60,7 +61,7 @@ public: catch(const uhd::io_error &ex) { std::string error_msg = str(boost::format( - "x300 fw communication failure #%u\n%s") % i % ex.what()); + "%s: x300 fw communication failure #%u\n%s") % __loc_info() % i % ex.what()); if (errors) UHD_LOGGER_ERROR("X300") << error_msg ; if (i == num_retries) throw uhd::io_error(error_msg); } @@ -80,7 +81,7 @@ public: catch(const uhd::io_error &ex) { std::string error_msg = str(boost::format( - "x300 fw communication failure #%u\n%s") % i % ex.what()); + "%s: x300 fw communication failure #%u\n%s") % __loc_info() % i % ex.what()); if (errors) UHD_LOGGER_ERROR("X300") << error_msg ; if (i == num_retries) throw uhd::io_error(error_msg); } @@ -94,6 +95,7 @@ protected: virtual void __poke32(const wb_addr_type addr, const uint32_t data) = 0; virtual uint32_t __peek32(const wb_addr_type addr) = 0; virtual void __flush() = 0; + virtual std::string __loc_info() = 0; boost::mutex reg_access; }; @@ -182,6 +184,11 @@ protected: while (udp->recv(boost::asio::buffer(buff), 0.0)){} //flush } + virtual std::string __loc_info(void) + { + return udp->get_send_addr(); + } + private: uhd::transport::udp_simple::sptr udp; size_t seq; @@ -290,6 +297,11 @@ protected: __peek32(0); } + virtual std::string __loc_info(void) + { + return boost::lexical_cast<std::string>(_drv_proxy->get_interface_num()); + } + private: niriok_proxy::sptr _drv_proxy; static const uint32_t READ_TIMEOUT_IN_MS = 100; |