Add a network info page (#2187)

Add network info page
This commit is contained in:
Hzj_jie
2016-07-26 21:32:13 -07:00
committed by Qingping Hou
parent 04d07699cf
commit ccbf8eac0c
3 changed files with 34 additions and 0 deletions

View File

@@ -196,4 +196,19 @@ function Device:exit()
self.screen:close()
end
function Device:retrieveNetworkInfo()
local std_out = io.popen("ifconfig | " ..
"sed -n " ..
"-e 's/ \\+$//g' " ..
"-e 's/ \\+/ /g' " ..
"-e 's/inet6\\? addr: \\?\\([^ ]\\+\\) .*$/\\1/p' " ..
"-e 's/Link encap:\\(.*\\)/\\1/p'",
"r")
if std_out then
local result = std_out:read("*all")
std_out:close()
return result
end
end
return Device