diff options
| author | Nicholas Corgan <nick.corgan@ettus.com> | 2013-09-03 14:39:46 -0700 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2013-09-06 11:13:49 -0700 | 
| commit | e8dfc4638222689c875f3c399c1dec667dca082d (patch) | |
| tree | af8a43c519faee8d23b87bbe18b2863d05df85bf | |
| parent | ba2a391d00b116ab8edaebb8c16ed2fc6727619e (diff) | |
| download | uhd-e8dfc4638222689c875f3c399c1dec667dca082d.tar.gz uhd-e8dfc4638222689c875f3c399c1dec667dca082d.tar.bz2 uhd-e8dfc4638222689c875f3c399c1dec667dca082d.zip  | |
utils: usrp_n2xx_net_burner_gui can now overwrite safe images with command line option
| -rwxr-xr-x | host/utils/usrp_n2xx_net_burner_gui.py | 38 | 
1 files changed, 24 insertions, 14 deletions
diff --git a/host/utils/usrp_n2xx_net_burner_gui.py b/host/utils/usrp_n2xx_net_burner_gui.py index 75d246c25..bad065f08 100755 --- a/host/utils/usrp_n2xx_net_burner_gui.py +++ b/host/utils/usrp_n2xx_net_burner_gui.py @@ -203,20 +203,30 @@ class USRPN2XXNetBurnerApp(tkinter.Frame):              #make a new burner object and attempt the burner operation              burner = usrp_n2xx_net_burner.burner_socket(addr=addr,quiet=False) -            for (image_type, fw_img, fpga_img) in (('FPGA', '', fpga), ('Firmware', fw, '')): -                #setup callbacks that update the gui -                def status_cb(status): -                    self._pbar.set(0.0) #status change, reset the progress -                    self._status.set("%s %s "%(status.title(), image_type)) -                    self.update() -                def progress_cb(progress): -                    self._pbar.set(progress) -                    self.update() -                burner.set_callbacks(progress_cb=progress_cb, status_cb=status_cb) -                burner.burn_fw(fw=fw_img, fpga=fpga_img, reset=False, safe=False, check_rev=not options.dont_check_rev) - -            if tkinter.messagebox.askyesno("Burn was successful!", "Reset the device?"): -                burner.reset_usrp() +            #setup callbacks that update the gui +            def status_cb(status): +                self._pbar.set(0.0) #status change, reset the progress +                self._status.set("%s %s "%(status.title(), image_type)) +                self.update() +            def progress_cb(progress): +                self._pbar.set(progress) +                self.update() + +            if options.overwrite_safe: +                if tkinter.messagebox.askyesno("Overwrite safe images?", "Overwrite safe images! This is ALMOST ALWAYS a terrible idea."): +                    for (image_type, fw_img, fpga_img) in (('FPGA', '', fpga), ('Firmware', fw, '')): +                        burner.set_callbacks(progress_cb=progress_cb, status_cb=status_cb) +                        burner.burn_fw(fw=fw_img, fpga=fpga_img, reset=False, safe=True, check_rev=not options.dont_check_rev) + +                    if tkinter.messagebox.askyesno("Burn was successful!", "Reset the device?"): +                        burner.reset_usrp() +            else: +                for (image_type, fw_img, fpga_img) in (('FPGA', '', fpga), ('Firmware', fw, '')): +                    burner.set_callbacks(progress_cb=progress_cb, status_cb=status_cb) +                    burner.burn_fw(fw=fw_img, fpga=fpga_img, reset=False, safe=False, check_rev=not options.dont_check_rev) + +                if tkinter.messagebox.askyesno("Burn was successful!", "Reset the device?"): +                    burner.reset_usrp()          except Exception as e:              tkinter.messagebox.showerror('Verbose:', 'Error: %s'%str(e))  | 
