aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2012-09-17 14:08:41 -0700
committerJosh Blum <josh@joshknows.com>2012-09-20 16:01:49 -0400
commit0ccf345303adea825d175955f979058da4401fbe (patch)
treec6d338f8d3afeb14c31ee40558a06e9518701b2b /host/utils
parent42243c91a959f412584d35b65bdc381162f20192 (diff)
downloaduhd-0ccf345303adea825d175955f979058da4401fbe.tar.gz
uhd-0ccf345303adea825d175955f979058da4401fbe.tar.bz2
uhd-0ccf345303adea825d175955f979058da4401fbe.zip
utils: More descriptive USRP N2XX Net Burner
* List option and GUI selection box display hardware revisions of detected units alongside IP addresses
Diffstat (limited to 'host/utils')
-rwxr-xr-xhost/utils/usrp_n2xx_net_burner.py14
-rwxr-xr-xhost/utils/usrp_n2xx_net_burner_gui.py9
2 files changed, 16 insertions, 7 deletions
diff --git a/host/utils/usrp_n2xx_net_burner.py b/host/utils/usrp_n2xx_net_burner.py
index f2cfb8ecf..56aa3aaee 100755
--- a/host/utils/usrp_n2xx_net_burner.py
+++ b/host/utils/usrp_n2xx_net_burner.py
@@ -222,7 +222,9 @@ def enumerate_devices():
pkt = sock.recv(UDP_MAX_XFER_BYTES)
(proto_ver, pktid, rxseq, ip_addr) = unpack_flash_ip_fmt(pkt)
if(pktid == update_id_t.USRP2_FW_UPDATE_ID_OHAI_OMG):
- yield socket.inet_ntoa(struct.pack("<L", socket.ntohl(ip_addr)))
+ use_addr = socket.inet_ntoa(struct.pack("<L", socket.ntohl(ip_addr)))
+ burner = burner_socket(use_addr, True)
+ yield "%s (%s)" % (socket.inet_ntoa(struct.pack("<L", socket.ntohl(ip_addr))), n2xx_revs[burner.get_hw_rev()][0])
except socket.timeout:
still_goin = False
@@ -230,12 +232,13 @@ def enumerate_devices():
# Burner class, holds a socket and send/recv routines
########################################################################
class burner_socket(object):
- def __init__(self, addr):
+ def __init__(self, addr, quiet):
self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ self._quiet = quiet
self._sock.settimeout(UDP_TIMEOUT)
self._sock.connect((addr, UDP_FW_UPDATE_PORT))
self.set_callbacks(lambda *a: None, lambda *a: None)
- self.init_update() #check that the device is there
+ self.init_update(quiet) #check that the device is there
self.get_hw_rev()
def set_callbacks(self, progress_cb, status_cb):
@@ -247,13 +250,13 @@ class burner_socket(object):
return self._sock.recv(UDP_MAX_XFER_BYTES)
#just here to validate comms
- def init_update(self):
+ def init_update(self,quiet):
out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_OHAI_LOL, seq(), 0, 0)
try: in_pkt = self.send_and_recv(out_pkt)
except socket.timeout: raise Exception("No response from device")
(proto_ver, pktid, rxseq, ip_addr) = unpack_flash_ip_fmt(in_pkt)
if pktid == update_id_t.USRP2_FW_UPDATE_ID_OHAI_OMG:
- print("USRP-N2XX found.")
+ if not quiet: print("USRP-N2XX found.")
else:
raise Exception("Invalid reply received from device.")
@@ -488,6 +491,7 @@ if __name__=='__main__':
if options.list:
print('Possible network devices:')
print(' ' + '\n '.join(enumerate_devices()))
+ #enumerate_devices()
exit()
if not options.addr: raise Exception('no address specified')
diff --git a/host/utils/usrp_n2xx_net_burner_gui.py b/host/utils/usrp_n2xx_net_burner_gui.py
index e2b79e72c..a9150bd88 100755
--- a/host/utils/usrp_n2xx_net_burner_gui.py
+++ b/host/utils/usrp_n2xx_net_burner_gui.py
@@ -96,7 +96,11 @@ class DeviceEntryWidget(tkinter.Frame):
tkinter.Button(self, text="Rescan for Devices", command=self._reload_cb).pack()
self._hints = tkinter.Listbox(self)
+ self._hints_addrs_only = tkinter.Listbox(self)
+
self._hints.bind("<<ListboxSelect>>", self._listbox_cb)
+ self._hints_addrs_only.bind("<<ListboxSelect>>", self._listbox_cb)
+
self._reload_cb()
self._hints.pack(expand=tkinter.YES, fill=tkinter.X)
@@ -112,10 +116,11 @@ class DeviceEntryWidget(tkinter.Frame):
self._hints.delete(0, tkinter.END)
for hint in usrp_n2xx_net_burner.enumerate_devices():
self._hints.insert(tkinter.END, hint)
+ self._hints_addrs_only.insert(tkinter.END, hint.split(" (")[0])
def _listbox_cb(self, event):
try:
- sel = self._hints.get(self._hints.curselection()[0])
+ sel = self._hints_addrs_only.get(self._hints.curselection()[0])
self._entry.delete(0, tkinter.END)
self._entry.insert(0, sel)
except Exception as e: print(e)
@@ -196,7 +201,7 @@ class USRPN2XXNetBurnerApp(tkinter.Frame):
self._disable_input()
try:
#make a new burner object and attempt the burner operation
- burner = usrp_n2xx_net_burner.burner_socket(addr=addr)
+ 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