wifi: provide link quality in percent
This commit is contained in:
parent
c532c0b080
commit
32a7be1d6d
2
README
2
README
|
@ -198,7 +198,7 @@ vicious.widgets.wifi
|
|||
- provides wireless information for a requested interface
|
||||
- takes the network interface as an argument, i.e. "wlan0"
|
||||
- returns a table with string keys: {ssid}, {mode}, {chan}, {rate},
|
||||
{link} and {sign}
|
||||
{link}, {linp} and {sign}
|
||||
|
||||
vicious.widgets.mbox
|
||||
- provides the subject of last e-mail in a mbox file
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
-- {{{ Grab environment
|
||||
local tonumber = tonumber
|
||||
local math = { ceil = math.ceil }
|
||||
local setmetatable = setmetatable
|
||||
local io = {
|
||||
open = io.open,
|
||||
|
@ -28,6 +29,7 @@ local winfo = {
|
|||
["{chan}"] = 0,
|
||||
["{rate}"] = 0,
|
||||
["{link}"] = 0,
|
||||
["{linp}"] = 0,
|
||||
["{sign}"] = 0
|
||||
}
|
||||
|
||||
|
@ -67,6 +69,9 @@ local function worker(format, warg)
|
|||
winfo["{sign}"] = -- Signal level can be a negative value, don't display decibel notation
|
||||
tonumber(string.match(iw, "Signal level[=:]([%-]?[%d]+)") or winfo["{sign}"])
|
||||
|
||||
-- Link quality percentage if quality was available
|
||||
if winfo["{link}"] ~= 0 then winfo["{linp}"] = math.ceil(winfo["{link}"] / 0.7) end
|
||||
|
||||
return winfo
|
||||
end
|
||||
-- }}}
|
||||
|
|
Loading…
Reference in New Issue