Notices


Reply
Thread Tools
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:
Posts: 482 | Thanked: 550 times | Joined on Oct 2010
#202
Thanks a lot! I will try to make a new version using this, as I cannot find documentation for pywifi on the n900 anywhere.
 

The Following User Says Thank You to skykooler For This Useful Post:
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#203
Yep. Meanwhile, I still can't find a good file to use for figuring out if the wifi module is loaded or not... I suppose I can check /proc/modules, and use a search function/call/whatever it's called, but whatever. I need to know if that's computationally more efficient than python calling a shell command every second, or searching 'proc/modules'... I guess it's ultimately the same or similar...

I'm thinking of using the /proc/net/dev file for calculating data traffic, as it seems to be the only place I've detected telephony data going in/out a lot when idling with GSM and 3G radios on. It also includes local and wmaster and wlan interfaces... I THINK I stumbled into the bt0 interface somewhere (bluetooth), but I can't for the life of me remember where, or if it had the right data.

The only problem is, if usb0 is up, I need to test if loading g_ether instead of g_nokia/g_file_storage and ifup'ing usb0 will change the line order in that file. And if so, that's extra if/then statement hell.

I also would LIKE to be fetching just DATA traffic, not internet traffic. So I want not just USB internet traffic, when available, but all USB data i/o, same with wlan, telephony, and bluetooth. I REALLY wish there was a convenient, nicely documented place where such system information could be found. If there is, I don't know where the documentation is, although I could probably spend more time looking in the development section of this site.
 
Posts: 482 | Thanked: 550 times | Joined on Oct 2010
#204
I am using /proc/net/dev for data traffic, you can use my code for reference on that area. I am also stumped on the USB front though.
 

The Following User Says Thank You to skykooler For This Useful Post:
Posts: 456 | Thanked: 1,580 times | Joined on Dec 2009
#205
Originally Posted by Mentalist Traceur View Post
Yep. Meanwhile, I still can't find a good file to use for figuring out if the wifi module is loaded or not... I suppose I can check /proc/modules, and use a search function/call/whatever it's called, but whatever. I need to know if that's computationally more efficient than python calling a shell command every second, or searching 'proc/modules'... I guess it's ultimately the same or similar...
Instead of polling you could also connect to D-Bus signals and let D-Bus notify you on state changes.
http://wiki.maemo.org/Documentation/..._D-Bus_Signals
See at the bottom for some examples of what signals are sent when the device goes off- and online again.
I think you can also get much more interesting stuff from D-Bus.

For a first example on how to use D-Bus in Python you could also look into /usr/lib/hildon-desktop/advanced-clock-plugin.py.
I am using D-Bus to get notified when the display turns off or the alarm is set.

You can get more info about what is going on on D-Bus either via "dbus-monitor --system" or install mdbus2 and use something like "mdbus2 -ls".
__________________
 

The Following User Says Thank You to Wonko For This Useful Post:
Posts: 1,522 | Thanked: 392 times | Joined on Jul 2010 @ São Paulo, Brazil
#206
 
Hootenholler's Avatar
Posts: 133 | Thanked: 140 times | Joined on Feb 2010 @ Bristol, UK
#207
Would someone be able to give me an idiot proof step by step on creating and installing a simple clock style to show time and date as "00:00 dd/mm" on one row of text without cutting characters off the end? I'd be very grateful!
 
Posts: 35 | Thanked: 9 times | Joined on Feb 2010 @ Perth, WA, Australia
#208
Brilliant clock! I like this alot. Had a bit of trouble getting it to work at first but that turned out to be the font colour and text scale at 1.

One question: With the custom format string, what is the format? I tried what i vaguely remembered from php forum settings (%M and such, but no joy. Thanks
 
Posts: 2,225 | Thanked: 3,822 times | Joined on Jun 2010 @ Florida
#209
Hello.

Skykooler: Yeah, I haven't had a chance to test USB too much. I HAVE noted that simply having data traffic through the USB port isn't reflected on usb0 in /proc/net/dev... I DIDN'T test usb0 for internet itself, yet, but that's reasonably predictable. It's just last time I ever used USB networking on my N900 was before my previous reflash, and I never bothered installing Mad Developer on my N900 again after I realized I didn't need it, because I realized I could do the same thing from the command line. (Though I'll admit, Mad Developer was useful enough I might just install it anyway. Even if I figure out how to do everything it did from the command line, the UI automated functionality of Mad Developer was undeniably convenient.)

Wonko: Yes, I am aware of dbus, and all the ungodly power of control and data it has. I use it in my auto-portrait/landscape-rearranging Conky.conf file, to query if the device is in portrait or landscape. And actually thought about doing it. I don't want to do "import dbus" or whatever just for a few status updates... If it looks like it's the best way to do it, though, I will. Also, do I actually NEED to import dbus libs into my clock style, or will it just use the same dbus functionality the whole clock has.

At any rate, thus far, I haven't bothered with dbus because one, it's outside my python knowledge to the point where it's the type of inconvenience I find it harder to motivate myself to overcome (vs, say, digging through every file in /proc/), and two, the fact that I felt a lot of the stuff I needed to do didn't need dbus. If it turns out some of the things are significantly processor/memory efficient with dbus, I will turn to that.

Hootenholler, give me a day or so and if you haven't figured it out and no one else has done it for you, I will. (In the meantime, use whatever you use to access files deep in the N900 filesystem to look at the .py files in /opt/maemo/usr/lib/advanced-clock-plugin/clocks/ - all you need to know can be relatively easily figured out from context in the decimal clock one, honestly.

Update re my clock style: I settled on a not-ideal way of distinguishing between driver loaded and driver unloaded. It'll do for now I guess. However, in the process I've discovered that lxp's injection capable driver reports slightly different things to /proc/net/dev and /proc/net/wireless. Not a big deal at all, but it's going to take extra fiddling, lol. At the moment, I am a bit distracted with injection testing, and uboot+lxp's-driver-supporting-power-kernel stuff, so don't expect another update too soon. As always, actual code for my clock style as it is currently is available on request. I just don't want to spam the thread with attachments of half-finished python.
 

The Following User Says Thank You to Mentalist Traceur For This Useful Post:
Posts: 1,042 | Thanked: 430 times | Joined on May 2010
#210
Hi again wonko... Another bug report
Seems like 12/24 hours option isn't working on the latest version. a while ago advanced clock plugin shows the time as 12:07AM while it should be 12:07PM(On any clocks)... Also whenever I change it to 24 hours mode it still show as 12:07AM where I don't think it should show AM or PM when on 24 hours mode right? :/
BTW changed my timezone...
 

The Following User Says Thank You to Radicalz38 For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 16:52.