aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/usrp2_card_burner.py
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-04-28 23:00:32 -0700
committerJosh Blum <josh@joshknows.com>2011-04-28 23:00:32 -0700
commit35d88b502f3a250ed638c3f268e543d611905490 (patch)
treec9c8a2824461ab9cb4fec3321121e75ab865682f /host/utils/usrp2_card_burner.py
parentf289d03d63b3e8f6009e1635ddcffbb196fb9eba (diff)
downloaduhd-35d88b502f3a250ed638c3f268e543d611905490.tar.gz
uhd-35d88b502f3a250ed638c3f268e543d611905490.tar.bz2
uhd-35d88b502f3a250ed638c3f268e543d611905490.zip
usrp2: card burner protections when the user specifies a device not in the list
Diffstat (limited to 'host/utils/usrp2_card_burner.py')
-rwxr-xr-xhost/utils/usrp2_card_burner.py14
1 files changed, 12 insertions, 2 deletions
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