diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/transport/usb_control.hpp | 2 | ||||
-rw-r--r-- | host/include/uhd/transport/usb_device_handle.hpp | 2 | ||||
-rw-r--r-- | host/include/uhd/transport/usb_zero_copy.hpp | 2 | ||||
-rw-r--r-- | host/lib/transport/libusb1_base.cpp | 56 | ||||
-rw-r--r-- | host/lib/transport/libusb1_base.hpp | 12 | ||||
-rw-r--r-- | host/lib/transport/libusb1_control.cpp | 6 | ||||
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 19 |
7 files changed, 78 insertions, 21 deletions
diff --git a/host/include/uhd/transport/usb_control.hpp b/host/include/uhd/transport/usb_control.hpp index 786bd0815..4576d6e92 100644 --- a/host/include/uhd/transport/usb_control.hpp +++ b/host/include/uhd/transport/usb_control.hpp @@ -26,7 +26,7 @@ class UHD_API usb_control : boost::noncopyable { public: typedef boost::shared_ptr<usb_control> sptr; - virtual ~usb_control(void) = 0; + virtual ~usb_control(void); /*! * Create a new USB control transport: diff --git a/host/include/uhd/transport/usb_device_handle.hpp b/host/include/uhd/transport/usb_device_handle.hpp index bf122f549..a8bbfc965 100644 --- a/host/include/uhd/transport/usb_device_handle.hpp +++ b/host/include/uhd/transport/usb_device_handle.hpp @@ -43,6 +43,8 @@ public: typedef boost::shared_ptr<usb_device_handle> sptr; typedef std::pair<boost::uint16_t, boost::uint16_t> vid_pid_pair_t; + virtual ~usb_device_handle(void); + /*! * Return the device's serial number * \return a string describing the device's serial number diff --git a/host/include/uhd/transport/usb_zero_copy.hpp b/host/include/uhd/transport/usb_zero_copy.hpp index eb28040b6..092873803 100644 --- a/host/include/uhd/transport/usb_zero_copy.hpp +++ b/host/include/uhd/transport/usb_zero_copy.hpp @@ -38,6 +38,8 @@ class UHD_API usb_zero_copy : public virtual zero_copy_if { public: typedef boost::shared_ptr<usb_zero_copy> sptr; + virtual ~usb_zero_copy(void); + /*! * Make a new zero copy USB transport: * This transport is for sending and receiving between the host diff --git a/host/lib/transport/libusb1_base.cpp b/host/lib/transport/libusb1_base.cpp index f92117a9e..c0c1d6a86 100644 --- a/host/lib/transport/libusb1_base.cpp +++ b/host/lib/transport/libusb1_base.cpp @@ -47,10 +47,7 @@ public: task_handler = task::make(boost::bind(&libusb_session_impl::libusb_event_handler_task, this, _context)); } - ~libusb_session_impl(void){ - task_handler.reset(); - libusb_exit(_context); - } + virtual ~libusb_session_impl(void); libusb_context *get_context(void) const{ return _context; @@ -86,6 +83,11 @@ private: } }; +libusb_session_impl::~libusb_session_impl(void){ + task_handler.reset(); + libusb_exit(_context); +} + libusb::session::sptr libusb::session::get_global_session(void){ static boost::weak_ptr<session> global_session; @@ -121,9 +123,7 @@ public: _dev = dev; } - ~libusb_device_impl(void){ - libusb_unref_device(this->get()); - } + virtual ~libusb_device_impl(void); libusb_device *get(void) const{ return _dev; @@ -134,6 +134,10 @@ private: libusb_device *_dev; }; +libusb_device_impl::~libusb_device_impl(void){ + libusb_unref_device(this->get()); +} + /*********************************************************************** * libusb device list **********************************************************************/ @@ -160,6 +164,8 @@ public: libusb_free_device_list(dev_list, false/*dont unref*/); } + virtual ~libusb_device_list_impl(void); + size_t size(void) const{ return _devs.size(); } @@ -172,6 +178,10 @@ private: std::vector<libusb::device::sptr> _devs; }; +libusb_device_list_impl::~libusb_device_list_impl(void){ + /* NOP */ +} + libusb::device_list::sptr libusb::device_list::make(void){ return sptr(new libusb_device_list_impl()); } @@ -190,6 +200,8 @@ public: UHD_ASSERT_THROW(libusb_get_device_descriptor(_dev->get(), &_desc) == 0); } + virtual ~libusb_device_descriptor_impl(void); + const libusb_device_descriptor &get(void) const{ return _desc; } @@ -227,6 +239,10 @@ private: libusb_device_descriptor _desc; }; +libusb_device_descriptor_impl::~libusb_device_descriptor_impl(void){ + /* NOP */ +} + libusb::device_descriptor::sptr libusb::device_descriptor::make(device::sptr dev){ return sptr(new libusb_device_descriptor_impl(dev)); } @@ -245,13 +261,7 @@ public: UHD_ASSERT_THROW(libusb_open(_dev->get(), &_handle) == 0); } - ~libusb_device_handle_impl(void){ - //release all claimed interfaces - for (size_t i = 0; i < _claimed.size(); i++){ - libusb_release_interface(this->get(), _claimed[i]); - } - libusb_close(_handle); - } + virtual ~libusb_device_handle_impl(void); libusb_device_handle *get(void) const{ return _handle; @@ -283,6 +293,14 @@ private: std::vector<int> _claimed; }; +libusb_device_handle_impl::~libusb_device_handle_impl(void){ + //release all claimed interfaces + for (size_t i = 0; i < _claimed.size(); i++){ + libusb_release_interface(this->get(), _claimed[i]); + } + libusb_close(_handle); +} + libusb::device_handle::sptr libusb::device_handle::get_cached_handle(device::sptr dev){ static uhd::dict<libusb_device *, boost::weak_ptr<device_handle> > handles; @@ -327,6 +345,8 @@ public: _dev = dev; } + virtual ~libusb_special_handle_impl(void); + libusb::device::sptr get_device(void) const{ return _dev; } @@ -361,6 +381,10 @@ private: libusb::device::sptr _dev; //always keep a reference to device }; +libusb_special_handle_impl::~libusb_special_handle_impl(void){ + /* NOP */ +} + libusb::special_handle::sptr libusb::special_handle::make(device::sptr dev){ return sptr(new libusb_special_handle_impl(dev)); } @@ -368,6 +392,10 @@ libusb::special_handle::sptr libusb::special_handle::make(device::sptr dev){ /*********************************************************************** * list device handles implementations **********************************************************************/ +usb_device_handle::~usb_device_handle(void) { + /* NOP */ +} + std::vector<usb_device_handle::sptr> usb_device_handle::get_device_list( boost::uint16_t vid, boost::uint16_t pid ){ diff --git a/host/lib/transport/libusb1_base.hpp b/host/lib/transport/libusb1_base.hpp index 2ff1291d9..6d104bc75 100644 --- a/host/lib/transport/libusb1_base.hpp +++ b/host/lib/transport/libusb1_base.hpp @@ -67,7 +67,7 @@ namespace libusb { public: typedef boost::shared_ptr<session> sptr; - virtual ~session(void) = 0; + virtual ~session(void); /*! * Level 0: no messages ever printed by the library (default) @@ -92,7 +92,7 @@ namespace libusb { public: typedef boost::shared_ptr<device> sptr; - virtual ~device(void) = 0; + virtual ~device(void); //! get the underlying device pointer virtual libusb_device *get(void) const = 0; @@ -106,7 +106,7 @@ namespace libusb { public: typedef boost::shared_ptr<device_list> sptr; - virtual ~device_list(void) = 0; + virtual ~device_list(void); //! make a new device list static sptr make(void); @@ -125,7 +125,7 @@ namespace libusb { public: typedef boost::shared_ptr<device_descriptor> sptr; - virtual ~device_descriptor(void) = 0; + virtual ~device_descriptor(void); //! make a new descriptor from a device reference static sptr make(device::sptr); @@ -143,7 +143,7 @@ namespace libusb { public: typedef boost::shared_ptr<device_handle> sptr; - virtual ~device_handle(void) = 0; + virtual ~device_handle(void); //! get a cached handle or make a new one given the device static sptr get_cached_handle(device::sptr); @@ -172,7 +172,7 @@ namespace libusb { public: typedef boost::shared_ptr<special_handle> sptr; - virtual ~special_handle(void) = 0; + virtual ~special_handle(void); //! make a new special handle from device static sptr make(device::sptr); diff --git a/host/lib/transport/libusb1_control.cpp b/host/lib/transport/libusb1_control.cpp index 699581839..a18f657d9 100644 --- a/host/lib/transport/libusb1_control.cpp +++ b/host/lib/transport/libusb1_control.cpp @@ -36,6 +36,8 @@ public: _handle->claim_interface(interface); } + virtual ~libusb_control_impl(void); + int submit(boost::uint8_t request_type, boost::uint8_t request, boost::uint16_t value, @@ -60,6 +62,10 @@ private: boost::mutex _mutex; }; +libusb_control_impl::~libusb_control_impl(void) { + /* NOP */ +} + /*********************************************************************** * USB control public make functions **********************************************************************/ diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index d2c7d2160..3f0db74de 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -125,6 +125,8 @@ public: _ctx(libusb::session::get_global_session()->get_context()), _lut(lut), _frame_size(frame_size) { /* NOP */ } + virtual ~libusb_zero_copy_mb(void); + void release(void){ _release_cb(this); } @@ -189,6 +191,10 @@ private: const size_t _frame_size; }; +libusb_zero_copy_mb::~libusb_zero_copy_mb(void) { + /* NOP */ +} + /*********************************************************************** * USB zero_copy device class **********************************************************************/ @@ -388,6 +394,8 @@ struct libusb_zero_copy_impl : usb_zero_copy size_t(hints.cast<double>("send_frame_size", DEFAULT_XFER_SIZE)))); } + virtual ~libusb_zero_copy_impl(void); + managed_recv_buffer::sptr get_recv_buff(double timeout) { boost::mutex::scoped_lock l(_recv_mutex); @@ -410,6 +418,17 @@ struct libusb_zero_copy_impl : usb_zero_copy boost::mutex _recv_mutex, _send_mutex; }; +libusb_zero_copy_impl::~libusb_zero_copy_impl(void) { + /* NOP */ +} + +/*********************************************************************** + * USB zero_copy destructor + **********************************************************************/ +usb_zero_copy::~usb_zero_copy(void) { + /* NOP */ +} + /*********************************************************************** * USB zero_copy make functions **********************************************************************/ |