diff options
author | Josh Blum <josh@joshknows.com> | 2011-04-30 17:11:46 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-04-30 17:11:46 -0700 |
commit | 493ed897f24fff5265b766ee634916b002cadf94 (patch) | |
tree | 09082fa8be0c71b92ca668083dd1519a452b679d /host/utils/usrp2_card_burner.py | |
parent | 7b509d6fe4ac4cfcafc63f11f5b298d3e0237acd (diff) | |
parent | 1e57d1c0496ca6263652cd84c9eeacafde833915 (diff) | |
download | uhd-493ed897f24fff5265b766ee634916b002cadf94.tar.gz uhd-493ed897f24fff5265b766ee634916b002cadf94.tar.bz2 uhd-493ed897f24fff5265b766ee634916b002cadf94.zip |
Merge branch 'master' into next
Conflicts:
host/lib/usrp/usrp2/usrp2_regs.cpp
Diffstat (limited to 'host/utils/usrp2_card_burner.py')
-rwxr-xr-x | host/utils/usrp2_card_burner.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/host/utils/usrp2_card_burner.py b/host/utils/usrp2_card_burner.py index 741c7e3e1..26adb91c7 100755 --- a/host/utils/usrp2_card_burner.py +++ b/host/utils/usrp2_card_burner.py @@ -56,6 +56,8 @@ def command(*args): def get_dd_path(): if platform.system() == 'Windows': + dd_path = os.path.join(os.path.dirname(__file__), 'dd.exe') + if os.path.exists(dd_path): return dd_path dd_path = os.path.join(tempfile.gettempdir(), 'dd.exe') if not os.path.exists(dd_path): print('Downloading dd.exe to %s'%dd_path) @@ -232,13 +234,9 @@ def get_options(): parser.add_option("--fw", type="string", help="firmware image path (optional)", default='') parser.add_option("--fpga", type="string", help="fpga image path (optional)", default='') parser.add_option("--list", action="store_true", help="list possible raw devices", default=False) + parser.add_option("--force", action="store_true", help="override safety check", default=False) (options, args) = parser.parse_args() - if options.list: - print('Possible raw devices:') - print(' ' + '\n '.join(get_raw_device_hints())) - exit() - return options ######################################################################## @@ -246,5 +244,19 @@ def get_options(): ######################################################################## if __name__=='__main__': options = get_options() + device_hints = get_raw_device_hints() + show_listing = options.list + + if not show_listing and not options.force and options.dev and options.dev not in device_hints: + print('The device "%s" was not in the list of possible raw devices.'%options.dev) + print('The card burner application will now exit without burning your card.') + print('To override this safety check, specify the --force option.\n') + show_listing = True + + if show_listing: + print('Possible raw devices:') + print(' ' + '\n '.join(device_hints)) + exit() + if not options.dev: raise Exception('no raw device path specified') print(burn_sd_card(dev=options.dev, fw=options.fw, fpga=options.fpga)) |