aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README14
-rw-r--r--TODO1
-rw-r--r--widgets/net.lua6
3 files changed, 12 insertions, 9 deletions
diff --git a/README b/README
index 5f07bc5..a8b2dab 100644
--- a/README
+++ b/README
@@ -167,8 +167,8 @@ vicious.widgets.fs
vicious.widgets.dio
- provides I/O statistics for requested storage devices
- - takes the disk as an argument, i.e. "sda" (or specific partition,
- i.e. "sda/sda5")
+ - takes the disk as an argument, i.e. "sda" (or a specific
+ partition, i.e. "sda/sda2")
- returns a table with string keys: {total_s}, {total_kb}, {total_mb},
{read_s}, {read_kb}, {read_mb}, {write_s}, {write_kb}, {write_mb}
and {sched}
@@ -187,12 +187,12 @@ vicious.widgets.hddtemp
{/dev/sda} and {/dev/sdc} for example
vicious.widgets.net
- - provides usage statistics for all network interfaces
+ - provides state and usage statistics of all network interfaces
- returns a table with string keys, using net interfaces as a base:
- {eth0 rx_b}, {eth0 tx_b}, {eth0 rx_kb}, {eth0 tx_kb}, {eth0 rx_mb},
- {eth0 tx_mb}, {eth0 rx_gb}, {eth0 tx_gb}, {eth0 down_b}, {eth0 up_b},
- {eth0 down_kb}, {eth0 up_kb}, {eth0 down_mb}, {eth0 up_mb},
- {eth0 down_gb}, {eth0 up_gb}, {eth1 rx_b} etc.
+ {eth0 carrier}, {eth0 rx_b}, {eth0 tx_b}, {eth0 rx_kb}, {eth0 tx_kb},
+ {eth0 rx_mb}, {eth0 tx_mb}, {eth0 rx_gb}, {eth0 tx_gb}, {eth0 down_b},
+ {eth0 up_b}, {eth0 down_kb}, {eth0 up_kb}, {eth0 down_mb},
+ {eth0 up_mb}, {eth0 down_gb}, {eth0 up_gb}, {eth1 rx_b} etc.
vicious.widgets.wifi
- provides wireless information for a requested interface
diff --git a/TODO b/TODO
index 187e6b1..6665fb1 100644
--- a/TODO
+++ b/TODO
@@ -5,7 +5,6 @@
* Vicious
-** TODO Import NET carrier detection from contrib
** TODO Consider including this code in format helper
- return format and format:gsub("${[^}]+}", "")
- Note: We should then also replace just $1/$2...
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] = {}