summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-07-21 15:01:13 -0700
committerJosh Blum <josh@joshknows.com>2011-07-21 15:01:13 -0700
commite03f7c7316c0fd5d6f522f6013d552a0185faa0f (patch)
treeab47f6384be4388a2ead5f08bf158f5108d84c3f
parent96bd5d54d60a5a252a6474dbc8ef3eaec06a65e5 (diff)
downloaduhd-e03f7c7316c0fd5d6f522f6013d552a0185faa0f.tar.gz
uhd-e03f7c7316c0fd5d6f522f6013d552a0185faa0f.tar.bz2
uhd-e03f7c7316c0fd5d6f522f6013d552a0185faa0f.zip
usrp2: use the command function from card burner for net burner ifconfig
-rwxr-xr-xhost/utils/usrp_n2xx_net_burner.py13
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