diff options
author | Josh Blum <josh@joshknows.com> | 2011-06-16 11:14:52 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-06-16 11:14:52 -0700 |
commit | 88129dc89b753a1e9ac9016ff5ffa02c6492e508 (patch) | |
tree | cd88e3cf0337e7fcd28adc1b7df51a933a9d997f /host/utils | |
parent | 6dbd79ab34878f2f8d5fa3b9040fd4d2e5854980 (diff) | |
download | uhd-88129dc89b753a1e9ac9016ff5ffa02c6492e508.tar.gz uhd-88129dc89b753a1e9ac9016ff5ffa02c6492e508.tar.bz2 uhd-88129dc89b753a1e9ac9016ff5ffa02c6492e508.zip |
fw_updater: windows enumeration works
Diffstat (limited to 'host/utils')
-rwxr-xr-x | host/utils/usrp_n2xx_net_burner.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/host/utils/usrp_n2xx_net_burner.py b/host/utils/usrp_n2xx_net_burner.py index ec2454606..269126972 100755 --- a/host/utils/usrp_n2xx_net_burner.py +++ b/host/utils/usrp_n2xx_net_burner.py @@ -184,17 +184,21 @@ def win_get_interfaces(): for a in adapterList: adNode = a.ipAddressList while True: - ipAddr = (adNode.ipAddress & adNode.ipMask) | ~adNode.ipMask - if ipAddr: - yield ipAddr + #convert ipAddr and ipMask into hex addrs that can be turned into a bcast addr + ipAddr = adNode.ipAddress + ipMask = adNode.ipMask + if ipAddr and ipMask: + hexAddr = struct.unpack("<L", socket.inet_aton(ipAddr))[0] + hexMask = struct.unpack("<L", socket.inet_aton(ipMask))[0] + if(hexAddr and hexMask): #don't broadcast on 255.255.255.255, that's just lame + yield socket.inet_ntoa(struct.pack("<L", (hexAddr & hexMask) | (~hexMask) & 0xFFFFFFFF)) adNode = adNode.next if not adNode: break def enumerate_devices(): - ifaces = get_interfaces() devices = [] - for bcast_addr in ifaces: + for bcast_addr in get_interfaces(): sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) sock.settimeout(0.1) |