diff options
author | Josh Blum <josh@joshknows.com> | 2011-07-21 15:01:13 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-07-21 15:01:13 -0700 |
commit | e03f7c7316c0fd5d6f522f6013d552a0185faa0f (patch) | |
tree | ab47f6384be4388a2ead5f08bf158f5108d84c3f /host | |
parent | 96bd5d54d60a5a252a6474dbc8ef3eaec06a65e5 (diff) | |
download | uhd-e03f7c7316c0fd5d6f522f6013d552a0185faa0f.tar.gz uhd-e03f7c7316c0fd5d6f522f6013d552a0185faa0f.tar.bz2 uhd-e03f7c7316c0fd5d6f522f6013d552a0185faa0f.zip |
usrp2: use the command function from card burner for net burner ifconfig
Diffstat (limited to 'host')
-rwxr-xr-x | host/utils/usrp_n2xx_net_burner.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/host/utils/usrp_n2xx_net_burner.py b/host/utils/usrp_n2xx_net_burner.py index 1df300c76..63a0fd8a1 100755 --- a/host/utils/usrp_n2xx_net_burner.py +++ b/host/utils/usrp_n2xx_net_burner.py @@ -127,12 +127,23 @@ def is_valid_fw_image(fw_image): ######################################################################## # interface discovery and device enumeration ######################################################################## +def command(*args): + p = subprocess.Popen( + args, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + ret = p.wait() + verbose = p.stdout.read().decode() + if ret != 0: raise Exception(verbose) + return verbose + def get_interfaces(): if(platform.system() is "Windows"): return win_get_interfaces() else: return unix_get_interfaces() def unix_get_interfaces(): - ifconfig = subprocess.check_output("/sbin/ifconfig") + ifconfig = command("/sbin/ifconfig") ip_addr_re = "cast\D*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" bcasts = re.findall(ip_addr_re, ifconfig) return bcasts |