X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/be44087bf603e595c684d83c727e6441c7b7f39a..c58ad4fb6f2c4c350a6aae01b100ebb4564ad8e9:/lib/wm_util.lua diff --git a/lib/wm_util.lua b/lib/wm_util.lua index bb5d8ee..984f6ae 100644 --- a/lib/wm_util.lua +++ b/lib/wm_util.lua @@ -104,3 +104,26 @@ function list_dir(name) end return result end + +function get_devid(config) + + local uci = require "uci" + + local web_devid = uci.get(config,"web","devid") + + if web_devid then + return web_devid + end + + web_iface = uci.get(config,"web","iface") + + if not web_iface then + web_iface = list_dir('/sys/class/net/')[1] + end + + io.input("/sys/class/net/"..web_iface.."/address") + + local web_devid = io.read("*line") + return web_devid:gsub(":",""):upper() + +end \ No newline at end of file