Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

owm: add "hardwareinfo" node for modelname and system-platform #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applications/luci-app-owm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-owm
PKG_RELEASE:=0.5.1
PKG_RELEASE:=0.5.2

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

Expand Down
28 changes: 5 additions & 23 deletions applications/luci-app-owm/luasrc/owm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,6 @@ local dofile, _G = dofile, _G
-- @cstyle instance
module "luci.owm"

-- backported from LuCI 0.11 and adapted form berlin-stats
--- Returns the system type (in a compatible way to LuCI 0.11)
-- @return String indicating this as an deprecated value
-- (instead of the Chipset-type)
-- @return String containing hardware model information
-- (trimmed to router-model only)
function sysinfo_for_kathleen020()
local cpuinfo = nixio.fs.readfile("/proc/cpuinfo")

local system = 'system is deprecated'

local model =
boardinfo['model'] or
cpuinfo:match("machine\t+: ([^\n]+)") or
cpuinfo:match("Hardware\t+: ([^\n]+)") or
nixio.uname().machine or
system

return system, model
end

-- inspired by luci.version
--- Returns the system version info build from /etc/openwrt_release
--- switch from luci.version which always includes
Expand Down Expand Up @@ -274,11 +253,14 @@ function get()
root.system = {
uptime = {sys.uptime()},
loadavg = {sysinfo.load[1] / 65536.0},
sysinfo = {sysinfo_for_kathleen020()},
}

root.hostname = sys.hostname() --owm
root.hardware = boardinfo['system'] --owm
root.hardwareinfo = {
system = boardinfo['system'], --owm
model = boardinfo['model'],
openwrt_boardname = boardinfo['board_name']
}

root.firmware = {
name=version.distname, --owm
Expand Down