From f289d03d63b3e8f6009e1635ddcffbb196fb9eba Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 28 Apr 2011 22:44:13 -0700 Subject: usrp2: include dd.exe in windows installers uhd build system downloads dd.exe from ettus.com so we dont have to check it in --- host/utils/usrp2_card_burner.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'host/utils/usrp2_card_burner.py') diff --git a/host/utils/usrp2_card_burner.py b/host/utils/usrp2_card_burner.py index 741c7e3e1..b1335dd6a 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) -- cgit v1.2.3 From 35d88b502f3a250ed638c3f268e543d611905490 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 28 Apr 2011 23:00:32 -0700 Subject: usrp2: card burner protections when the user specifies a device not in the list --- host/utils/usrp2_card_burner.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'host/utils/usrp2_card_burner.py') diff --git a/host/utils/usrp2_card_burner.py b/host/utils/usrp2_card_burner.py index b1335dd6a..ae6198eef 100755 --- a/host/utils/usrp2_card_burner.py +++ b/host/utils/usrp2_card_burner.py @@ -234,11 +234,21 @@ 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: + device_hints = get_raw_device_hints() + show_listing = options.list + + if not show_listing and not options.force 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(get_raw_device_hints())) + print(' ' + '\n '.join(device_hints)) exit() return options -- cgit v1.2.3 From 1e57d1c0496ca6263652cd84c9eeacafde833915 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 29 Apr 2011 15:56:44 -0700 Subject: usrp2: move card burner code out of get_options so get_options can be used by the gui without interference --- host/utils/usrp2_card_burner.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'host/utils/usrp2_card_burner.py') diff --git a/host/utils/usrp2_card_burner.py b/host/utils/usrp2_card_burner.py index ae6198eef..26adb91c7 100755 --- a/host/utils/usrp2_card_burner.py +++ b/host/utils/usrp2_card_burner.py @@ -237,10 +237,17 @@ def get_options(): parser.add_option("--force", action="store_true", help="override safety check", default=False) (options, args) = parser.parse_args() + return options + +######################################################################## +# main +######################################################################## +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 not in device_hints: + 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') @@ -251,12 +258,5 @@ def get_options(): print(' ' + '\n '.join(device_hints)) exit() - return options - -######################################################################## -# main -######################################################################## -if __name__=='__main__': - options = get_options() if not options.dev: raise Exception('no raw device path specified') print(burn_sd_card(dev=options.dev, fw=options.fw, fpga=options.fpga)) -- cgit v1.2.3