View Single Post
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#201
Originally Posted by skykooler View Post
@Mentalist Traceur: Are you using pywifi for the wifi monitor? For some reason it always returns values in the range 200-204 and I am wondering whether I am implementing it correctly.
Nah, I though it'd be more efficiently to find the file where signal strength is stored, and go with that... I'm VERY tempted to also make it a bar, instead of a number, and add a bar for WiFi noise level, since it's in the same file, and is useful system information.

I like your idea of using pywifi (though mainly because I like finding out about packages because I can learn more python, and I like learning everything), but I wanted to avoid calling/importing anything other than the absolutely necessary stuff, since this is running in the system pretty much non-stop, except maybe when hidden.

I just file("/proc/net/wireless", 'r'). Third line, value index 3 (fourth value), is the signal, in dBm. "Higher" (remember it's negative integers) values are 'clearer' signals. So 90-something noise is good (value index 4), 90-something signal is bad. There's also a "link" (value index 2). Funny enough, Signal (it's called "level" in that file) is an integer, while "link" and "noise" seem to be floating point. I can figure out the same info from iwconfig command, but I don't want python running a shell command unless I have to... Which I might, because that's the only place I can see a difference in monitor/managed mode.

Oh, while I remember: When you have WiFi module unloaded, as per the WiFi switcher or Advanced Interface Switcher, /proc/net/wireless does NOT have the third line. So what I do is measure the len(file("/proc/net/wireless", 'r')), and if it's two, do the gray X, if it's 3, check the signal. I haven't yet implemented a filter for if it's loaded but-not-connected, but I suspect all I need is to either check to see if link, level, and noise are all zeroes, and use that as a check for wifi on-but-unconnected, OR wait until I figure out where to most efficiently fetch the data traffic rate. Then I can use that, I suspect.

TiagoTiago: I think if you put the /n characted in the command line of the settings option, it will conflict with the actual python interpreter of the command. Where-as this is set within that clock style to separate each line (which themselves might require new-lines in their code to print one output line).

Last edited by Mentalist Traceur; 2011-01-04 at 08:59. Reason: Remember something for skykooler
 

The Following User Says Thank You to Mentalist Traceur For This Useful Post: