summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-freifunk/luasrc/controller
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-01-15 14:11:35 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-15 14:11:35 +0100
commit64d0031233a7e1b7e4df71953bc0fa72462e6bf5 (patch)
tree1551cacf8b51298bebec7280416c2a053965d52a /modules/luci-mod-freifunk/luasrc/controller
parenta1f67784c9ef2a95facba658fce6ae57a795758c (diff)
luci-mod-freifunk: eliminate uses of luci.sys.sysinfo()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-mod-freifunk/luasrc/controller')
-rw-r--r--modules/luci-mod-freifunk/luasrc/controller/freifunk/freifunk.lua36
1 files changed, 32 insertions, 4 deletions
diff --git a/modules/luci-mod-freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/luci-mod-freifunk/luasrc/controller/freifunk/freifunk.lua
index d4606e750f..bb58a3f10f 100644
--- a/modules/luci-mod-freifunk/luasrc/controller/freifunk/freifunk.lua
+++ b/modules/luci-mod-freifunk/luasrc/controller/freifunk/freifunk.lua
@@ -139,14 +139,42 @@ function jsonstatus()
local ffznet = ffzone and cursor:get("firewall", ffzone, "network")
local ffwifs = ffznet and util.split(ffznet, " ") or {}
+ local sysinfo = util.ubus("system", "info") or { }
+ local boardinfo = util.ubus("system", "board") or { }
+
+ local loads = sysinfo.load or { 0, 0, 0 }
+
+ local memory = sysinfo.memory or {
+ total = 0,
+ free = 0,
+ shared = 0,
+ buffered = 0
+ }
+
+ local swap = sysinfo.swap or {
+ total = 0,
+ free = 0
+ }
+
root.protocol = 1
root.system = {
- uptime = {sys.uptime()},
- loadavg = {sys.loadavg()},
- sysinfo = {sys.sysinfo()},
- hostname = sys.hostname()
+ uptime = { sysinfo.uptime or 0 },
+ loadavg = { loads[1] / 65535.0, loads[2] / 65535.0, loads[3] / 65535.0 },
+ sysinfo = {
+ boardinfo.system or "?",
+ boardinfo.model or "?",
+ memory.total,
+ 0, -- former cached memory
+ memory.buffered,
+ memory.free,
+ 0, -- former bogomips
+ swap.total,
+ 0, -- former cached swap
+ swap.free
+ },
+ hostname = boardinfo.hostname
}
root.firmware = {