shdown / luastatus

universal status bar content generator
GNU General Public License v3.0
295 stars 12 forks source link

signal_dbm does not update #42

Closed lieux closed 5 years ago

lieux commented 5 years ago

I tried placing my laptop far away from the router, then close to it, but the signal does not change. It only updates when I reconnect to the network but then it just stays with the first signal detected.

shdown commented 5 years ago

Are you sure that:

1) you have the timeout option of the plugin set (to something sensible, e.g. 10), and

2) you are waiting that amount of seconds (10 in our example) before reconnecting?

shdown commented 5 years ago

Also, please try i3-msg restart and report if the signal changes.

lieux commented 5 years ago

Still no changes. I have timeout=10. I waited for several seconds each time I place the laptop somewhere and it does not update.

Also did i3-msg restart. Nothing happens.

lieux commented 5 years ago

Here is the code:

widget = {
    plugin = 'network-linux',
    opts = {
        wireless = true,
        timeout = 10
    },
    cb = function(t)
        if not t then
            return nil
        end
        local dbm
        for iface, param in pairs(t) do
            if param.wireless then
                if param.wireless.signal_dbm then
                    dbm = param.wireless.signal_dbm
                end
            end
        end
        return {
            full_text = string.format('%s', dbm)
        }
    end
}
lieux commented 5 years ago

And also, the example wireless.lua is not updating (signal bars not changing).

shdown commented 5 years ago

I waited for several seconds each time I place the laptop somewhere and it does not update.

Have you been waiting for 10 seconds?

Also did i3-msg restart. Nothing happens.

Then, the problem is in your driver, because this restarts the luastatus process (so it has no chance to cache the signal information anywhere).

And, are you sure that reconnecting updates it?

shdown commented 5 years ago

Also, as an experiment, can you please launch i3status (with a config that displays wireless %quality, default will do) in the terminal and see if it changes?

lieux commented 5 years ago

Have you been waiting for 10 seconds?

Yes. Minutes even just to make sure.

And, are you sure that reconnecting updates it?

Yes. By just toggling airplane mode.

i3status

I tried it. Set the global interval to 1 but still it's not changing. So I guess it really is a driver problem. Thanks!

shdown commented 5 years ago

Hmm, interesting, the same is going on on my machine. cat /proc/net/wireless updates in the real time.

The code for the network-linux plugin was adapted from i3status, so there’s a bug either in:

  1. i3status’ code for retrieving the wireless parameters;

  2. libnl;

  3. kernel driver.

I will probably investigate it later.

P.S. I’ve just found a bug in network-linux that has nothing to do with the quality not updating, but could crash the entire luastatus process when reconnecting, so please update (fixed with f403c84228ab2ddfe20f1c2e8ea8339f83cd6da5 commit).

shdown commented 5 years ago

Also, i3status has a bug open for it: https://github.com/i3/i3status/issues/106

shdown commented 5 years ago

Fixed, please try now.

lieux commented 5 years ago

It's working. Thank you!