From e03f7c7316c0fd5d6f522f6013d552a0185faa0f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 21 Jul 2011 15:01:13 -0700 Subject: usrp2: use the command function from card burner for net burner ifconfig --- host/utils/usrp_n2xx_net_burner.py | 13 ++++++++++++- 1 file changed, 12 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 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 -- cgit v1.2.3