diff options
| -rw-r--r-- | host/include/uhd/transport/usb_control.hpp | 4 | ||||
| -rw-r--r-- | host/lib/transport/libusb1_control.cpp | 2 | ||||
| -rw-r--r-- | host/lib/usrp/usrp1/usrp1_ctrl.cpp | 7 | ||||
| -rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 15 | 
4 files changed, 14 insertions, 14 deletions
| diff --git a/host/include/uhd/transport/usb_control.hpp b/host/include/uhd/transport/usb_control.hpp index 6137ecf84..f9829c3ec 100644 --- a/host/include/uhd/transport/usb_control.hpp +++ b/host/include/uhd/transport/usb_control.hpp @@ -50,9 +50,9 @@ public:       * \param index        2-byte (wIndex)       * \param buff         buffer to hold send or receive data       * \param length       2-byte (wLength) -     * \return             number of bytes submitted +     * \return             number of bytes submitted or error code       */ -    virtual size_t submit(boost::uint8_t request_type, +    virtual ssize_t submit(boost::uint8_t request_type,                            boost::uint8_t request,                            boost::uint16_t value,                            boost::uint16_t index,  diff --git a/host/lib/transport/libusb1_control.cpp b/host/lib/transport/libusb1_control.cpp index c989a788c..f903907d0 100644 --- a/host/lib/transport/libusb1_control.cpp +++ b/host/lib/transport/libusb1_control.cpp @@ -33,7 +33,7 @@ public:          _handle->claim_interface(0 /* control interface */);      } -    size_t submit(boost::uint8_t request_type, +    ssize_t submit(boost::uint8_t request_type,                    boost::uint8_t request,                    boost::uint16_t value,                    boost::uint16_t index, diff --git a/host/lib/usrp/usrp1/usrp1_ctrl.cpp b/host/lib/usrp/usrp1/usrp1_ctrl.cpp index 76e8ce368..5d73e6dd9 100644 --- a/host/lib/usrp/usrp1/usrp1_ctrl.cpp +++ b/host/lib/usrp/usrp1/usrp1_ctrl.cpp @@ -209,9 +209,9 @@ public:              }                //type 0x01 is end               else if (type == 0x01) { +                usrp_set_firmware_hash(hash); //set hash before reset                  usrp_control_write(FX2_FIRMWARE_LOAD, 0xe600, 0,                                     &reset_n, 1); -                usrp_set_firmware_hash(hash);                  file.close();                  //wait for things to settle @@ -267,8 +267,9 @@ public:              return -1;          } -        ssize_t n; -        while ((n = file.readsome((char *)buf, sizeof(buf))) > 0) { +        while (not file.eof()) { +            file.read((char *)buf, sizeof(buf)); +            size_t n = file.gcount();              ret = usrp_control_write(VRQ_FPGA_LOAD, 0, FL_XFER,                                       buf, n);              if (ret != n) { diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index 80ea49e9d..b4c23bf12 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -74,14 +74,14 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)      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(vid, pid); - -    if(device_list.size() == 0) return usrp1_addrs; //return nothing if no USRPs found +    // Important note: +    // The get device list calls are nested inside the for loop. +    // This allows the usb guts to decontruct when not in use, +    // so that re-enumeration after fw load can occur successfully. +    // This requirement is a courtesy of libusb1.0 on windows.      //find the usrps and load firmware -    BOOST_FOREACH(usb_device_handle::sptr handle, device_list) { +    BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) {              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); @@ -90,9 +90,8 @@ static device_addrs_t usrp1_find(const device_addr_t &hint)      //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) { +    BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) {              device_addr_t new_addr;              new_addr["type"] = "usrp1";              new_addr["serial"] = handle->get_serial(); | 
