summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/transport/libusb1_control.cpp8
-rw-r--r--host/lib/transport/libusb1_zero_copy.cpp18
-rw-r--r--host/lib/transport/usb_dummy_impl.cpp5
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp14
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp10
5 files changed, 29 insertions, 26 deletions
diff --git a/host/lib/transport/libusb1_control.cpp b/host/lib/transport/libusb1_control.cpp
index bce3d4b0b..3d9b38785 100644
--- a/host/lib/transport/libusb1_control.cpp
+++ b/host/lib/transport/libusb1_control.cpp
@@ -28,10 +28,10 @@ const int libusb_timeout = 0;
**********************************************************************/
class libusb_control_impl : public usb_control {
public:
- libusb_control_impl(libusb::device_handle::sptr handle):
+ libusb_control_impl(libusb::device_handle::sptr handle, const size_t interface):
_handle(handle)
{
- _handle->claim_interface(0 /* control interface */);
+ _handle->claim_interface(interface);
}
ssize_t submit(boost::uint8_t request_type,
@@ -60,8 +60,8 @@ private:
/***********************************************************************
* USB control public make functions
**********************************************************************/
-usb_control::sptr usb_control::make(usb_device_handle::sptr handle){
+usb_control::sptr usb_control::make(usb_device_handle::sptr handle, const size_t interface){
return sptr(new libusb_control_impl(libusb::device_handle::get_cached_handle(
boost::static_pointer_cast<libusb::special_handle>(handle)->get_device()
- )));
+ ), interface));
}
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp
index ada664286..28d6cdd5b 100644
--- a/host/lib/transport/libusb1_zero_copy.cpp
+++ b/host/lib/transport/libusb1_zero_copy.cpp
@@ -159,8 +159,10 @@ public:
libusb_zero_copy_impl(
libusb::device_handle::sptr handle,
- size_t recv_endpoint,
- size_t send_endpoint,
+ const size_t recv_interface,
+ const size_t recv_endpoint,
+ const size_t send_interface,
+ const size_t send_endpoint,
const device_addr_t &hints
):
_handle(handle),
@@ -173,8 +175,8 @@ public:
_next_recv_buff_index(0),
_next_send_buff_index(0)
{
- _handle->claim_interface(2 /*in interface*/);
- _handle->claim_interface(1 /*out interface*/);
+ _handle->claim_interface(recv_interface);
+ _handle->claim_interface(send_interface);
//allocate libusb transfer structs and managed receive buffers
for (size_t i = 0; i < get_num_recv_frames(); i++){
@@ -280,14 +282,16 @@ private:
**********************************************************************/
usb_zero_copy::sptr usb_zero_copy::make(
usb_device_handle::sptr handle,
- size_t recv_endpoint,
- size_t send_endpoint,
+ const size_t recv_interface,
+ const size_t recv_endpoint,
+ const size_t send_interface,
+ const size_t send_endpoint,
const device_addr_t &hints
){
libusb::device_handle::sptr dev_handle(libusb::device_handle::get_cached_handle(
boost::static_pointer_cast<libusb::special_handle>(handle)->get_device()
));
return sptr(new libusb_zero_copy_impl(
- dev_handle, recv_endpoint, send_endpoint, hints
+ dev_handle, recv_interface, recv_endpoint, send_interface, send_endpoint, hints
));
}
diff --git a/host/lib/transport/usb_dummy_impl.cpp b/host/lib/transport/usb_dummy_impl.cpp
index 930678405..7be753f76 100644
--- a/host/lib/transport/usb_dummy_impl.cpp
+++ b/host/lib/transport/usb_dummy_impl.cpp
@@ -27,13 +27,12 @@ std::vector<usb_device_handle::sptr> usb_device_handle::get_device_list(boost::u
return std::vector<usb_device_handle::sptr>(); //empty list
}
-usb_control::sptr usb_control::make(usb_device_handle::sptr){
+usb_control::sptr usb_control::make(usb_device_handle::sptr, const size_t){
throw uhd::not_implemented_error("no usb support -> usb_control::make not implemented");
}
usb_zero_copy::sptr usb_zero_copy::make(
- usb_device_handle::sptr,
- size_t, size_t, const device_addr_t &
+ usb_device_handle::sptr, const size_t, const size_t, const size_t, const size_t, const device_addr_t &
){
throw uhd::not_implemented_error("no usb support -> usb_zero_copy::make not implemented");
}
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index 89c9598b3..39996a821 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -83,7 +83,7 @@ static device_addrs_t b100_find(const device_addr_t &hint)
UHD_LOG << "the firmware image: " << b100_fw_image << std::endl;
usb_control::sptr control;
- try{control = usb_control::make(handle);}
+ try{control = usb_control::make(handle, 0);}
catch(const uhd::exception &){continue;} //ignore claimed
fx2_ctrl::make(control)->usrp_load_firmware(b100_fw_image);
@@ -100,7 +100,7 @@ static device_addrs_t b100_find(const device_addr_t &hint)
//Attempt to read the name from the EEPROM and perform filtering.
try{
- usb_control::sptr control = usb_control::make(handle);
+ usb_control::sptr control = usb_control::make(handle, 0);
fx2_ctrl::sptr fx2_ctrl = fx2_ctrl::make(control);
const mboard_eeprom_t mb_eeprom = mboard_eeprom_t(*fx2_ctrl, mboard_eeprom_t::MAP_B000);
new_addr["name"] = mb_eeprom["name"];
@@ -159,7 +159,7 @@ b100_impl::b100_impl(const device_addr_t &device_addr){
UHD_ASSERT_THROW(handle.get() != NULL); //better be found
//create control objects
- usb_control::sptr fx2_transport = usb_control::make(handle);
+ usb_control::sptr fx2_transport = usb_control::make(handle, 0);
_fx2_ctrl = fx2_ctrl::make(fx2_transport);
this->check_fw_compat(); //check after making fx2
//-- setup clock after making fx2 and before loading fpga --//
@@ -175,8 +175,8 @@ b100_impl::b100_impl(const device_addr_t &device_addr){
_ctrl_transport = usb_zero_copy::make(
handle,
- 8,
- 4,
+ 4, 8, //interface, endpoint
+ 3, 4, //interface, endpoint
ctrl_xport_args
);
@@ -216,8 +216,8 @@ b100_impl::b100_impl(const device_addr_t &device_addr){
_data_transport = usb_zero_copy::make_wrapper(
usb_zero_copy::make(
handle, // identifier
- 6, // IN endpoint
- 2, // OUT endpoint
+ 2, 6, // IN interface, endpoint
+ 1, 2, // OUT interface, endpoint
data_xport_args // param hints
)
);
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index b2da16837..dbf7a5092 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -87,7 +87,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
UHD_LOG << "USRP1 firmware image: " << usrp1_fw_image << std::endl;
usb_control::sptr control;
- try{control = usb_control::make(handle);}
+ try{control = usb_control::make(handle, 0);}
catch(const uhd::exception &){continue;} //ignore claimed
fx2_ctrl::make(control)->usrp_load_firmware(usrp1_fw_image);
@@ -99,7 +99,7 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) {
usb_control::sptr control;
- try{control = usb_control::make(handle);}
+ try{control = usb_control::make(handle, 0);}
catch(const uhd::exception &){continue;} //ignore claimed
fx2_ctrl::sptr fx2_ctrl = fx2_ctrl::make(control);
@@ -161,13 +161,13 @@ usrp1_impl::usrp1_impl(const device_addr_t &device_addr){
// Create controller objects
////////////////////////////////////////////////////////////////////
//usb_control::sptr usb_ctrl = usb_control::make(handle);
- _fx2_ctrl = fx2_ctrl::make(usb_control::make(handle));
+ _fx2_ctrl = fx2_ctrl::make(usb_control::make(handle, 0));
_fx2_ctrl->usrp_load_fpga(usrp1_fpga_image);
_fx2_ctrl->usrp_init();
_data_transport = usb_zero_copy::make(
handle, // identifier
- 6, // IN endpoint
- 2, // OUT endpoint
+ 2, 6, // IN interface, endpoint
+ 1, 2, // OUT interface, endpoint
device_addr // param hints
);
_iface = usrp1_iface::make(_fx2_ctrl);