aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M
diff options
context:
space:
mode:
authorkurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597>2011-11-26 03:18:51 +0000
committerkurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597>2011-11-26 03:18:51 +0000
commit0803ad9ad96a59427dbb8093375572ba683c0be2 (patch)
treecd01876097b2826ec441a9a670fc834c28f06bd4 /Transceiver52M
parent543540406c945c1bcbc1ded8b47d4f9224b1711b (diff)
transceiver: reroute uhd messages to logging facility
Pipe the following uhd message types to standard warning levels (INFO, WARN, ERROR) respectively. Ignore fastpath logging messages and, instead, catch them from the asynchronous device interface. enum type_t{ status = 's', warning = 'w', error = 'e', fastpath= 'f' }; Signed-off-by: Thomas Tsou <ttsou@vt.edu> git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2676 19bc5d8c-e614-43d4-8b26-e1612bc8e597
Diffstat (limited to 'Transceiver52M')
-rw-r--r--Transceiver52M/UHDDevice.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index cc90d73..261eabc 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -24,6 +24,7 @@
#include "Logger.h"
#include <uhd/usrp/single_usrp.hpp>
#include <uhd/utils/thread_priority.hpp>
+#include <uhd/utils/msg.hpp>
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -240,6 +241,28 @@ void *async_event_loop(uhd_device *dev)
}
}
+/*
+ Catch and drop underrun 'U' and overrun 'O' messages from stdout
+ since we already report using the logging facility. Direct
+ everything else appropriately.
+ */
+void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg)
+{
+ switch (type) {
+ case uhd::msg::status:
+ LOG(INFO) << msg;
+ break;
+ case uhd::msg::warning:
+ LOG(WARN) << msg;
+ break;
+ case uhd::msg::error:
+ LOG(ERROR) << msg;
+ break;
+ case uhd::msg::fastpath:
+ break;
+ }
+}
+
uhd_device::uhd_device(double rate, bool skip_rx)
: desired_smpl_rt(rate), actual_smpl_rt(0),
tx_gain(0.0), tx_gain_min(0.0), tx_gain_max(0.0),
@@ -352,6 +375,9 @@ bool uhd_device::open()
{
LOG(INFO) << "creating USRP device...";
+ // Register msg handler
+ uhd::msg::register_handler(&uhd_msg_handler);
+
// Allow all UHD devices
uhd::device_addr_t dev_addr("");
try {