From c713f8a4727b140f8524dd38b81ab2a9077859ff Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Wed, 15 Jun 2011 18:45:44 -0700 Subject: fw_updater: device enumeration support, not integrated into main app yet --- host/utils/usrp_n2xx_net_burner.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'host/utils') diff --git a/host/utils/usrp_n2xx_net_burner.py b/host/utils/usrp_n2xx_net_burner.py index 65ddfa4e7..878b8b28c 100755 --- a/host/utils/usrp_n2xx_net_burner.py +++ b/host/utils/usrp_n2xx_net_burner.py @@ -191,6 +191,28 @@ def win_get_interfaces(): if not adNode: break +def enumerate_devices(): + ifaces = get_interfaces() + devices = [] + for bcast_addr in ifaces: + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) + sock.settimeout(UDP_TIMEOUT) + print "Sending bcast pkt to %s" % bcast_addr + out_pkt = pack_flash_args_fmt(USRP2_FW_PROTO_VERSION, update_id_t.USRP2_FW_UPDATE_ID_OHAI_LOL, 0, 0, 0) + sock.sendto(out_pkt, (bcast_addr, UDP_FW_UPDATE_PORT)) + still_goin = True + while(still_goin): + try: + 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): + devices.append(socket.inet_ntoa(struct.pack("