diff options
author | Josh Blum <josh@joshknows.com> | 2012-11-12 13:25:28 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-11-12 13:25:28 -0800 |
commit | d66d697d6b3999e3bea91239c63ebc0a9ec0802b (patch) | |
tree | 66b95c6b427fbc161ca73944e9812c4507632682 /host | |
parent | c7968a6b0e544236657946943610b9a147b7d569 (diff) | |
parent | 104867d4a0557c97495613aa9e44c970c677c16f (diff) | |
download | uhd-d66d697d6b3999e3bea91239c63ebc0a9ec0802b.tar.gz uhd-d66d697d6b3999e3bea91239c63ebc0a9ec0802b.tar.bz2 uhd-d66d697d6b3999e3bea91239c63ebc0a9ec0802b.zip |
Merge branch 'maint'
Diffstat (limited to 'host')
-rw-r--r-- | host/CMakeLists.txt | 2 | ||||
-rw-r--r-- | host/docs/images.rst | 13 | ||||
-rw-r--r-- | host/docs/usrp2.rst | 11 | ||||
-rw-r--r-- | host/include/uhd/types/stream_cmd.hpp | 10 | ||||
-rw-r--r-- | host/utils/uhd_images_downloader.py.in | 111 |
5 files changed, 87 insertions, 60 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 829148adf..1b9d96518 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -71,7 +71,7 @@ ENDIF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "") #force UHD_RELEASE_MODE to be a string for cmake-gui -SET(UHD_RELEASE_MODE CACHE STRING "${UHD_RELEASE_MODE}" FORCE) +SET(UHD_RELEASE_MODE "${UHD_RELEASE_MODE}" CACHE STRING "UHD Release Mode") IF(CMAKE_COMPILER_IS_GNUCXX) ADD_DEFINITIONS(-Wall) diff --git a/host/docs/images.rst b/host/docs/images.rst index eaddfdf1d..dc9770460 100644 --- a/host/docs/images.rst +++ b/host/docs/images.rst @@ -24,7 +24,6 @@ Pre-built images are available for download. * `Master Branch images <http://files.ettus.com/binaries/master_images/>`_ * `Maint Branch images <http://files.ettus.com/binaries/maint_images/>`_ -* `Next Branch images <http://files.ettus.com/binaries/next_images/>`_ See the UHD wiki for the download link. @@ -34,6 +33,18 @@ The pre-built images come in two forms: * stand-alone platform-independent archive files ^^^^^^^^^^^^^^^^^^^^^^ +UHD Images Downloader +^^^^^^^^^^^^^^^^^^^^^^ + +The UHD Images Downloader is a new feature in UHD 003.005.000. This script downloads UHD images that +are guaranteed to be compatible with the host code and places them in the default images +directory. + +By default, it can be found at: **<install-path>/share/uhd/utils/uhd_images_downloader.py** + +By default, it installs images to: **<install-path>/share/uhd/images** + +^^^^^^^^^^^^^^^^^^^^^^ Platform installers ^^^^^^^^^^^^^^^^^^^^^^ The UNIX-based installers will install the images into **/usr/share/uhd/images**. diff --git a/host/docs/usrp2.rst b/host/docs/usrp2.rst index 8e9aa6d50..075a9684e 100644 --- a/host/docs/usrp2.rst +++ b/host/docs/usrp2.rst @@ -94,6 +94,17 @@ Use the net burner tool (Windows) <path_to_python.exe> <install-path>/share/uhd/utils/usrp_n2xx_net_burner_gui.py ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Burning images without Python +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For users who do not wish to install Python, a new script is available in UHD 003.005.000: +the USRP N2XX Simple Net Burner. It provides the same functionality as its Python +counterpart, but by default, it automatically installs the default images without the user needing +to specify their location on the command line. + +The utility can be found at: **<install-path>/share/uhd/utils/usrp_n2xx_simple_net_burner** + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Device recovery and bricking ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Its possible to put the device into an unusable state by loading bad images. diff --git a/host/include/uhd/types/stream_cmd.hpp b/host/include/uhd/types/stream_cmd.hpp index 41708e2e2..3c34c9656 100644 --- a/host/include/uhd/types/stream_cmd.hpp +++ b/host/include/uhd/types/stream_cmd.hpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2012 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -46,10 +46,10 @@ namespace uhd{ struct UHD_API stream_cmd_t{ enum stream_mode_t { - STREAM_MODE_START_CONTINUOUS = 'a', - STREAM_MODE_STOP_CONTINUOUS = 'o', - STREAM_MODE_NUM_SAMPS_AND_DONE = 'd', - STREAM_MODE_NUM_SAMPS_AND_MORE = 'm' + STREAM_MODE_START_CONTINUOUS = int('a'), + STREAM_MODE_STOP_CONTINUOUS = int('o'), + STREAM_MODE_NUM_SAMPS_AND_DONE = int('d'), + STREAM_MODE_NUM_SAMPS_AND_MORE = int('m') } stream_mode; size_t num_samps; diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in index 59c0fbafe..a57f9dc48 100644 --- a/host/utils/uhd_images_downloader.py.in +++ b/host/utils/uhd_images_downloader.py.in @@ -26,6 +26,14 @@ import tempfile import urllib2 import zipfile +class temp_dir(): + + def __enter__(self): + self.name = tempfile.mkdtemp() + return self.name + def __exit__(self, type, value, traceback): + os.removedirs(self.name) + if __name__ == "__main__": #Command line options @@ -38,65 +46,62 @@ if __name__ == "__main__": images_src = "@UHD_IMAGES_DOWNLOAD_SRC@" filename = images_src.split("/")[-1] - #Create temporary directory - download_dir = tempfile.mkdtemp() - atexit.register(lambda: shutil.rmtree(download_dir)) - - #Make sure we download into the correct directory - os.chdir(download_dir) + with temp_dir() as dirname: + os.chdir(dirname) - #Configuring image destination - if options.install_location != "": - images_dir = options.install_location - else: - images_dir = "@CMAKE_INSTALL_PREFIX@/share/uhd/images" - - u = urllib2.urlopen(images_src) - f = open(filename, "wb") - meta = u.info() - filesize = float(meta.getheaders("Content-Length")[0]) - - print "Downloading images from: %s" % images_src - - filesize_dl = 0.0 + #Configuring image destination + if options.install_location != "": + images_dir = options.install_location + else: + images_dir = "@CMAKE_INSTALL_PREFIX@/share/uhd/images" + + u = urllib2.urlopen(images_src) + f = open(filename, "wb") + meta = u.info() + filesize = float(meta.getheaders("Content-Length")[0]) + + print "Downloading images from: %s" % images_src + + filesize_dl = 0.0 - #Downloading file - while True: - buffer = u.read(options.buffer_size) - if not buffer: - break - - filesize_dl -= len(buffer) - f.write(buffer) + #Downloading file + while True: + buffer = u.read(options.buffer_size) + if not buffer: + break + + filesize_dl -= len(buffer) + f.write(buffer) - status = r"%2.2f MB/%2.2f MB (%3.2f" % (-filesize_dl/1e6, filesize/1e6, (-filesize_dl*100.)/filesize) + r"%)" - status += chr(8)*(len(status)+1) - print status, - - f.close() + status = r"%2.2f MB/%2.2f MB (%3.2f" % (-filesize_dl/1e6, filesize/1e6, (-filesize_dl*100.)/filesize) + r"%)" + status += chr(8)*(len(status)+1) + print status, + + f.close() - #Extracting contents of zip file - if os.path.exists("tempdir"): - shutil.rmtree("tempdir") - os.mkdir("tempdir") + #Extracting contents of zip file + if os.path.exists("tempdir"): + shutil.rmtree("tempdir") + os.mkdir("tempdir") - images_zip = zipfile.ZipFile(filename) - images_zip.extractall("tempdir") + images_zip = zipfile.ZipFile(filename) + images_zip.extractall("tempdir") - #Removing images currently in images_dir - if os.path.exists(images_dir): - try: - shutil.rmtree(images_dir) - except: - sys.stderr.write("\nMake sure you have write permissions in the images directory.\n") - sys.exit(0) + #Removing images currently in images_dir + if os.path.exists(images_dir): + try: + shutil.rmtree(images_dir) + except: + sys.stderr.write("\nMake sure you have write permissions in the images directory.\n") + sys.exit(0) - #Copying downloaded images into images_dir - shutil.copytree("tempdir/%s/share/uhd/images" % filename[:-4],images_dir) + #Copying downloaded images into images_dir + shutil.copytree("tempdir/%s/share/uhd/images" % filename[:-4],images_dir) - #Removing tempdir and zip file - shutil.rmtree("tempdir") - images_zip.close() - os.remove(filename) + #Removing tempdir and zip file + shutil.rmtree("tempdir") + images_zip.close() + os.remove(filename) - print "\nImages successfully installed to: %s" % images_dir + os.chdir(images_dir) + print "\nImages successfully installed to: %s" % images_dir |