aboutsummaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2010-07-19 02:12:00 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2010-07-19 02:14:50 +0200
commitd91266357a0d36f17fb48d367d4ab1c6429b505d (patch)
treebde2a7a39d4fbbaa1c06d7efe7deefacdd8d912a /widgets
parent8674c919d64291827eec05e1e3fbc21c29a7396e (diff)
downloadvicious-legacy-d91266357a0d36f17fb48d367d4ab1c6429b505d.tar.xz
net: add operational state support
Diffstat (limited to 'widgets')
-rw-r--r--widgets/net.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/widgets/net.lua b/widgets/net.lua
index 9eda942..5991b40 100644
--- a/widgets/net.lua
+++ b/widgets/net.lua
@@ -14,7 +14,7 @@ local helpers = require("vicious.helpers")
-- }}}
--- Net: provides usage statistics for all network interfaces
+-- Net: provides state and usage statistics of all network interfaces
module("vicious.widgets.net")
@@ -43,6 +43,10 @@ local function worker(format)
helpers.uformat(args, name .. " rx", recv, unit)
helpers.uformat(args, name .. " tx", send, unit)
+ -- Operational state and carrier detection
+ local sysnet = helpers.pathtotable("/sys/class/net/" .. name)
+ args["{"..name.." carrier}"] = tonumber(sysnet.carrier) or 0
+
if nets[name] == nil then
-- Default values on the first run
nets[name] = {}