aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/UHDDevice.cpp
diff options
context:
space:
mode:
authorkurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597>2011-11-28 06:26:04 +0000
committerkurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597>2011-11-28 06:26:04 +0000
commit4403d4ff7cb453451e792be388b15f7081545d67 (patch)
tree5f9a0c20074a24e643c0ed29ba85828eebc84d1d /Transceiver52M/UHDDevice.cpp
parent523ae5a69eff0156220a0bb07c4a1a658dd2f0dd (diff)
transceiver, uhd: exit informatively if no devices are found
Perform a UHD device search before constructing the object, and inform the user if no device is found. No device found is the most common reason for the transceiver to fail with the dreaded error "assuming TRX is dead". Signed-off-by: Thomas Tsou <ttsou@vt.edu> git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2699 19bc5d8c-e614-43d4-8b26-e1612bc8e597
Diffstat (limited to 'Transceiver52M/UHDDevice.cpp')
-rw-r--r--Transceiver52M/UHDDevice.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index fd15332..89f1231 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -425,11 +425,18 @@ bool uhd_device::open()
// Register msg handler
uhd::msg::register_handler(&uhd_msg_handler);
- // Allow all UHD devices
- LOG(INFO) << "Creating transceiver with first found UHD device";
- uhd::device_addr_t dev_addr("");
+ // Find UHD devices
+ uhd::device_addr_t args("");
+ uhd::device_addrs_t dev_addrs = uhd::device::find(args);
+ if (dev_addrs.size() == 0) {
+ LOG(ALERT) << "No UHD devices found";
+ return false;
+ }
+
+ // Use the first found device
+ LOG(INFO) << "Using discovered UHD device " << dev_addrs[0].to_string();
try {
- usrp_dev = uhd::usrp::single_usrp::make(dev_addr);
+ usrp_dev = uhd::usrp::single_usrp::make(dev_addrs[0]);
} catch(...) {
LOG(ALERT) << "UHD make failed";
return false;