summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorThomas Tsou <ttsou@vt.edu>2010-08-26 12:21:50 -0700
committerThomas Tsou <ttsou@vt.edu>2010-08-26 12:21:50 -0700
commitfe7df530e69834e974108d2c3e682f38b8a75524 (patch)
treeeef6db48251f83f0df21f10b4f9e8187eea4d9c2 /host/lib/usrp
parent687e118eefd7e35e3a094152a51927bd82ac030d (diff)
downloaduhd-fe7df530e69834e974108d2c3e682f38b8a75524.tar.gz
uhd-fe7df530e69834e974108d2c3e682f38b8a75524.tar.bz2
uhd-fe7df530e69834e974108d2c3e682f38b8a75524.zip
usrp1: Modifiy USB transport implementations to use new interface
Common libusb1 code is consolidated in the libusb base file.
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index ee6fe6e99..a4effb907 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -48,13 +48,15 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
if (hint.has_key("type") and hint["type"] != "usrp1") return usrp1_addrs;
//see what we got on the USB bus
- usb_descriptors_t usb_descriptors;
- usb_descriptors = usb_control::get_device_list();
+ std::vector<usb_device_handle::sptr> device_list =
+ usb_device_handle::get_device_list();
//find the usrps and load firmware
- BOOST_FOREACH(usb_descriptor_t desc, usb_descriptors) {
- if (desc.vendor_id == 0xfffe && desc.product_id == 0x0002) {
- usb_control::sptr ctrl_transport = usb_control::make(desc);
+ BOOST_FOREACH(usb_device_handle::sptr handle, device_list) {
+ if (handle->get_vendor_id() == 0xfffe &&
+ handle->get_product_id() == 0x0002) {
+
+ usb_control::sptr ctrl_transport = usb_control::make(handle);
usrp_ctrl::sptr usrp_ctrl = usrp_ctrl::make(ctrl_transport);
usrp_ctrl->usrp_load_firmware(filename);
}
@@ -64,13 +66,15 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
sleep(1);
//get descriptors again with serial number
- usb_descriptors = usb_control::get_device_list();
+ device_list = usb_device_handle::get_device_list();
+
+ BOOST_FOREACH(usb_device_handle::sptr handle, device_list) {
+ if (handle->get_vendor_id() == 0xfffe &&
+ handle->get_product_id() == 0x0002) {
- BOOST_FOREACH(usb_descriptor_t desc, usb_descriptors) {
- if (desc.vendor_id == 0xfffe && desc.product_id == 0x0002) {
device_addr_t new_addr;
new_addr["type"] = "usrp1";
- new_addr["serial"] = desc.serial;
+ new_addr["serial"] = handle->get_serial();
usrp1_addrs.push_back(new_addr);
}
}
@@ -93,22 +97,23 @@ static device::sptr usrp1_make(const device_addr_t &device_addr)
std::cout << "Make usrp1 with " << filename << std::endl;
//try to match the given device address with something on the USB bus
- usb_descriptors_t usb_descriptors;
- usb_descriptors = usb_control::get_device_list();
+ std::vector<usb_device_handle::sptr> device_list =
+ usb_device_handle::get_device_list();
//create data and control transports
usb_zero_copy::sptr data_transport;
usrp_ctrl::sptr usrp_ctrl;
- BOOST_FOREACH(usb_descriptor_t desc, usb_descriptors) {
- if (desc.serial == device_addr["serial"]
- && desc.vendor_id == 0xfffe && desc.product_id == 0x0002) {
+ BOOST_FOREACH(usb_device_handle::sptr handle, device_list) {
+ if (handle->get_vendor_id() == 0xfffe &&
+ handle->get_product_id() == 0x0002 &&
+ handle->get_serial() == device_addr["serial"]) {
- usb_control::sptr ctrl_transport = usb_control::make(desc);
+ usb_control::sptr ctrl_transport = usb_control::make(handle);
usrp_ctrl = usrp_ctrl::make(ctrl_transport);
usrp_ctrl->usrp_load_fpga(filename);
- data_transport = usb_zero_copy::make(desc, // identifier
+ data_transport = usb_zero_copy::make(handle, // identifier
6, // IN endpoint
2, // OUT endpoint
2 * (1 << 20), // buffer size