After I sent the question I remembered that pcdata is not providing
any data - it is just formatting data for output.
And the variable model, that is being formatted is coming from luci.sys.sysinfo

That function's code makes it all too clear:

function sysinfo()
        local cpuinfo = fs.readfile("/proc/cpuinfo")
        local meminfo = fs.readfile("/proc/meminfo")

        local memtotal = tonumber(meminfo:match("MemTotal:%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("[Bb]ogo[Mm][Ii][Pp][Ss].-:
([^\n]+)")) or 0

        local system =
                cpuinfo:match("system type\t+: ([^\n]+)") or
                cpuinfo:match("Processor\t+: ([^\n]+)") or
                cpuinfo:match("model name\t+: ([^\n]+)")

        local model =
                cpuinfo:match("machine\t+: ([^\n]+)") or
                cpuinfo:match("Hardware\t+: ([^\n]+)") or
                luci.util.pcdata(fs.readfile("/proc/diag/model")) or
                nixio.uname().machine or
                system

        return system, model, memtotal, memcached, membuffers, memfree, bogomips
end

Remaining question:
I have not checked the nixio code but I assume
nixio.uname().machine
would be
uname -m
in a bash shell script, right?


On 16 August 2011 08:55, Hanno Schupp <hanno.sch...@gmail.com> wrote:
> In the status overview I see the statement
> <%=pcdata(model or "?")%>
> which displays the detected router model, if detected. So far so good.
>
> Three questions:
> 1) How can I access the same model data from the bash shell?
> 2) What other useful data is accessible under pcdata?
> 3) Which program does this model detection ( I assume it is part of
> the start up sequence )? -  I would like to know from which point in
> the /etc/init.d sequence of start up programs the information is
> available.
>
> Any pointers welcome.
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to