diff options
author | Nicholas Corgan <nick.corgan@ettus.com> | 2012-06-07 12:30:21 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-06-07 15:05:41 -0700 |
commit | e7df63844f0920d35bc76a9fe70f9bbb59443c2f (patch) | |
tree | 63cff49610a8f03c2168f7144e662662bb843392 /host/lib/usrp/usrp2 | |
parent | 49d4f8e479534d856a242c2271d1b930487aea6c (diff) | |
download | uhd-e7df63844f0920d35bc76a9fe70f9bbb59443c2f.tar.gz uhd-e7df63844f0920d35bc76a9fe70f9bbb59443c2f.tar.bz2 uhd-e7df63844f0920d35bc76a9fe70f9bbb59443c2f.zip |
utils: UHD Image Downloader - downloads firmware/FPGA images compatible with the current host code and places them in the images directory
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index a05710891..7c26e2e71 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -376,6 +376,13 @@ public: } if (fw_image.empty() or fpga_image.empty()) return ""; + //does your platform use sudo? + std::string sudo; + #if defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_MACOS) + sudo = "sudo "; + #endif + + //look up the real FS path to the images std::string fw_image_path, fpga_image_path; try{ @@ -383,15 +390,9 @@ public: fpga_image_path = uhd::find_image_path(fpga_image); } catch(const std::exception &){ - return str(boost::format("Could not find %s and %s in your images path!") % fw_image % fpga_image); + return str(boost::format("Could not find %s and %s in your images path!\n%s") % fw_image % fpga_image % print_images_error()); } - //does your platform use sudo? - std::string sudo; - #if defined(UHD_PLATFORM_LINUX) || defined(UHD_PLATFORM_MACOS) - sudo = "sudo"; - #endif - //escape char for multi-line cmd + newline + indent? #ifdef UHD_PLATFORM_WIN32 const std::string ml = "^\n "; @@ -399,15 +400,18 @@ public: const std::string ml = "\\\n "; #endif - //create the burner command + //create the images downloader and burner commands + const std::string images_downloader_cmd = str(boost::format("%s\"%s\"") % sudo % find_images_downloader()); if (this->get_rev() == USRP2_REV3 or this->get_rev() == USRP2_REV4){ const std::string card_burner = (fs::path(fw_image_path).branch_path().branch_path() / "utils" / "usrp2_card_burner_gui.py").string(); - return str(boost::format("Please run:\n%s \"%s\" %s--fpga=\"%s\" %s--fw=\"%s\"") % sudo % card_burner % ml % fpga_image_path % ml % fw_image_path); + const std::string card_burner_cmd = str(boost::format("\"%s%s\" %s--fpga=\"%s\" %s--fw=\"%s\"") % sudo % card_burner % ml % fpga_image_path % ml % fw_image_path); + return str(boost::format("%s\n%s") % print_images_error() % card_burner_cmd); } else{ const std::string addr = _ctrl_transport->get_recv_addr(); const std::string net_burner = (fs::path(fw_image_path).branch_path().branch_path() / "utils" / "usrp_n2xx_net_burner_gui.py").string(); - return str(boost::format("Please run:\n\"%s\" %s--fpga=\"%s\" %s--fw=\"%s\" %s--addr=\"%s\"") % net_burner % ml % fpga_image_path % ml % fw_image_path % ml % addr); + const std::string net_burner_cmd = str(boost::format("\"%s\" %s--fpga=\"%s\" %s--fw=\"%s\" %s--addr=\"%s\"") % net_burner % ml % fpga_image_path % ml % fw_image_path % ml % addr); + return str(boost::format("%s\n%s") % print_images_error() % net_burner_cmd); } } |