aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1/usrp1_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp1/usrp1_impl.cpp')
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index 3c3306525..8ad148274 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -34,6 +34,11 @@ using namespace uhd;
using namespace uhd::usrp;
using namespace uhd::transport;
+const boost::uint16_t USRP1_VENDOR_ID = 0xfffe;
+const boost::uint16_t USRP1_PRODUCT_ID = 0x0002;
+const boost::uint16_t FX2_VENDOR_ID = 0x04b4;
+const boost::uint16_t FX2_PRODUCT_ID = 0x8613;
+
const std::vector<usrp1_impl::dboard_slot_t> usrp1_impl::_dboard_slots = boost::assign::list_of
(usrp1_impl::DBOARD_SLOT_A)(usrp1_impl::DBOARD_SLOT_B)
;
@@ -54,33 +59,32 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)
);
std::cout << "USRP1 firmware image: " << usrp1_fw_image << std::endl;
+ boost::uint16_t vid = hint.has_key("uninit") ? FX2_VENDOR_ID : USRP1_VENDOR_ID;
+ boost::uint16_t pid = hint.has_key("uninit") ? FX2_PRODUCT_ID : USRP1_PRODUCT_ID;
+
//see what we got on the USB bus
std::vector<usb_device_handle::sptr> device_list =
- usb_device_handle::get_device_list();
+ usb_device_handle::get_device_list(vid, pid);
+
+ if(device_list.size() == 0) return usrp1_addrs; //return nothing if no USRPs found
//find the usrps and load firmware
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(usrp1_fw_image);
- }
}
- //get descriptors again with serial number
- device_list = usb_device_handle::get_device_list();
+ //get descriptors again with serial number, but using the initialized VID/PID now since we have firmware
+ vid = USRP1_VENDOR_ID;
+ pid = USRP1_PRODUCT_ID;
+ device_list = usb_device_handle::get_device_list(vid, pid);
BOOST_FOREACH(usb_device_handle::sptr handle, device_list) {
- if (handle->get_vendor_id() == 0xfffe &&
- handle->get_product_id() == 0x0002) {
-
device_addr_t new_addr;
new_addr["type"] = "usrp1";
new_addr["serial"] = handle->get_serial();
usrp1_addrs.push_back(new_addr);
- }
}
return usrp1_addrs;
@@ -99,17 +103,15 @@ static device::sptr usrp1_make(const device_addr_t &device_addr)
//try to match the given device address with something on the USB bus
std::vector<usb_device_handle::sptr> device_list =
- usb_device_handle::get_device_list();
+ usb_device_handle::get_device_list(USRP1_VENDOR_ID, USRP1_PRODUCT_ID);
//create data and control transports
usb_zero_copy::sptr data_transport;
usrp_ctrl::sptr usrp_ctrl;
- 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"]) {
+ BOOST_FOREACH(usb_device_handle::sptr handle, device_list) {
+ if (handle->get_serial() == device_addr["serial"]) {
usb_control::sptr ctrl_transport = usb_control::make(handle);
usrp_ctrl = usrp_ctrl::make(ctrl_transport);
usrp_ctrl->usrp_load_fpga(usrp1_fpga_image);