summaryrefslogtreecommitdiffstats
path: root/host/lib/transport
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-09-19 16:14:12 -0700
committerJosh Blum <josh@joshknows.com>2011-09-19 16:14:12 -0700
commitc35462adaf8e7ede3da961df92ddbfc78b2c8708 (patch)
treee84ac9c6e5a5281e2106efd2cd4cc515c944dd19 /host/lib/transport
parentb20c9fc836a0f32666739dcd143692149eb66c68 (diff)
downloaduhd-c35462adaf8e7ede3da961df92ddbfc78b2c8708.tar.gz
uhd-c35462adaf8e7ede3da961df92ddbfc78b2c8708.tar.bz2
uhd-c35462adaf8e7ede3da961df92ddbfc78b2c8708.zip
usb: added interface args to usb abstractions
Diffstat (limited to 'host/lib/transport')
-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
3 files changed, 17 insertions, 14 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");
}