aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorMarcus Müller <marcus.mueller@ettus.com>2015-02-27 19:44:26 +0100
committerMartin Braun <martin.braun@ettus.com>2015-03-03 14:12:43 -0800
commit499bcc0238315a2e1f01625d725a67b168acb99f (patch)
treef059e1e126f7a6817a2e9675f66417ce563439a0 /host/lib
parent963dcaa6a75862aec9ee4924dd88fa0901b39934 (diff)
downloaduhd-499bcc0238315a2e1f01625d725a67b168acb99f.tar.gz
uhd-499bcc0238315a2e1f01625d725a67b168acb99f.tar.bz2
uhd-499bcc0238315a2e1f01625d725a67b168acb99f.zip
uhd: Fixed: Exception during detection kills device::make
On systems with libusb but not USB, device detection for USB devices fails (lsusb itself dies with "error -99"). This crashes the device detection process itself. Also made the documentation for ::make match what it actually does.
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/device.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/host/lib/device.cpp b/host/lib/device.cpp
index 006ea6ec8..3e84d5bea 100644
--- a/host/lib/device.cpp
+++ b/host/lib/device.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2011,2014 Ettus Research LLC
+// Copyright 2010-2011,2014-2015 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -90,9 +90,9 @@ device_addrs_t device::find(const device_addr_t &hint, device_filter_t filter){
device_addrs_t device_addrs;
- BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()){
- try{
- if(filter == ANY or fcn.get<2>() == filter){
+ BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()) {
+ try {
+ if (filter == ANY or fcn.get<2>() == filter) {
device_addrs_t discovered_addrs = fcn.get<0>()(hint);
device_addrs.insert(
device_addrs.begin(),
@@ -101,7 +101,7 @@ device_addrs_t device::find(const device_addr_t &hint, device_filter_t filter){
);
}
}
- catch(const std::exception &e){
+ catch (const std::exception &e) {
UHD_MSG(error) << "Device discovery error: " << e.what() << std::endl;
}
}
@@ -119,12 +119,17 @@ device::sptr device::make(const device_addr_t &hint, device_filter_t filter, siz
std::vector<dev_addr_make_t> dev_addr_makers;
BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()){
- if(filter == ANY or fcn.get<2>() == filter){
- BOOST_FOREACH(device_addr_t dev_addr, fcn.get<0>()(hint)){
- //append the discovered address and its factory function
- dev_addr_makers.push_back(dev_addr_make_t(dev_addr, fcn.get<1>()));
+ try{
+ if(filter == ANY or fcn.get<2>() == filter){
+ BOOST_FOREACH(device_addr_t dev_addr, fcn.get<0>()(hint)){
+ //append the discovered address and its factory function
+ dev_addr_makers.push_back(dev_addr_make_t(dev_addr, fcn.get<1>()));
+ }
}
}
+ catch(const std::exception &e){
+ UHD_MSG(error) << "Device discovery error: " << e.what() << std::endl;
+ }
}
//check that we found any devices