From d91266357a0d36f17fb48d367d4ab1c6429b505d Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Mon, 19 Jul 2010 02:12:00 +0200 Subject: net: add operational state support --- widgets/net.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'widgets/net.lua') 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] = {} -- cgit v1.2.3