summaryrefslogtreecommitdiffstats
path: root/host/lib/transport
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-10-01 12:14:07 -0700
committerJosh Blum <josh@joshknows.com>2010-10-01 12:14:07 -0700
commita772f4536e46227df3301c637927c3fbfb69a08d (patch)
treee7072893c0a6bc11a72463a08dac616801bbaa44 /host/lib/transport
parent67e302ee255922c021ce2c12efdbbaad46a787dc (diff)
parent3a1138bc4a8595c5ea95a10f5ffdf0cb6a326b08 (diff)
downloaduhd-a772f4536e46227df3301c637927c3fbfb69a08d.tar.gz
uhd-a772f4536e46227df3301c637927c3fbfb69a08d.tar.bz2
uhd-a772f4536e46227df3301c637927c3fbfb69a08d.zip
Merge branch 'next'
Diffstat (limited to 'host/lib/transport')
-rw-r--r--host/lib/transport/libusb1_base.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/host/lib/transport/libusb1_base.cpp b/host/lib/transport/libusb1_base.cpp
index 49f524a32..910b04fc8 100644
--- a/host/lib/transport/libusb1_base.cpp
+++ b/host/lib/transport/libusb1_base.cpp
@@ -213,15 +213,21 @@ private:
libusb::device_handle::sptr libusb::device_handle::get_cached_handle(device::sptr dev){
static uhd::dict<libusb_device *, boost::weak_ptr<device_handle> > handles;
- //not expired -> get existing session
+ //not expired -> get existing handle
if (handles.has_key(dev->get()) and not handles[dev->get()].expired()){
return handles[dev->get()].lock();
}
- //create a new global session
- sptr new_handle(new libusb_device_handle_impl(dev));
- handles[dev->get()] = new_handle;
- return new_handle;
+ //create a new cached handle
+ try{
+ sptr new_handle(new libusb_device_handle_impl(dev));
+ handles[dev->get()] = new_handle;
+ return new_handle;
+ }
+ catch(const std::exception &e){
+ std::cerr << "USB open failed: see the application notes for your device." << std::endl;
+ throw std::runtime_error(e.what());
+ }
}
/***********************************************************************