libs/sys: Filter model string from /proc/diag/model
[project/luci.git] / libs / sys / luasrc / sys.lua
index 722d5a3..8b05d44 100644 (file)
@@ -175,7 +175,7 @@ function sysinfo()
        local memcached = tonumber(meminfo:match("\nCached:%s*(%d+)"))
        local memfree = tonumber(meminfo:match("MemFree:%s*(%d+)"))
        local membuffers = tonumber(meminfo:match("Buffers:%s*(%d+)"))
        local memcached = tonumber(meminfo:match("\nCached:%s*(%d+)"))
        local memfree = tonumber(meminfo:match("MemFree:%s*(%d+)"))
        local membuffers = tonumber(meminfo:match("Buffers:%s*(%d+)"))
-       local bogomips = tonumber(cpuinfo:match("BogoMIPS.-:%s*([^\n]+)"))
+       local bogomips = tonumber(cpuinfo:match("[Bb]ogo[Mm][Ii][Pp][Ss].-: ([^\n]+)")) or 0
 
        local system =
                cpuinfo:match("system type\t+: ([^\n]+)") or
 
        local system =
                cpuinfo:match("system type\t+: ([^\n]+)") or
@@ -185,8 +185,8 @@ function sysinfo()
        local model =
                cpuinfo:match("machine\t+: ([^\n]+)") or
                cpuinfo:match("Hardware\t+: ([^\n]+)") or
        local model =
                cpuinfo:match("machine\t+: ([^\n]+)") or
                cpuinfo:match("Hardware\t+: ([^\n]+)") or
-               fs.readfile("/proc/diag/model") or
-               nixio.uname().machine() or
+               luci.util.pcdata(fs.readfile("/proc/diag/model")) or
+               nixio.uname().machine or
                system
 
        return system, model, memtotal, memcached, membuffers, memfree, bogomips
                system
 
        return system, model, memtotal, memcached, membuffers, memfree, bogomips