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
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 @@
 	// 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;