Reply
Thread Tools
BrentDC's Avatar
Posts: 903 | Thanked: 632 times | Joined on Apr 2008
#1
Sorry for being a nuisance, but programming is a learning experience.

And sometimes I get stuck and need help


So my current dilemma is as follows:

I'm trying to write a (Python) application that logs battery level and I need to catch the dbus signal for when the charger is plugged in / unplugged.

The problem is, I have absolutely no idea how to do this. I've been reading up on dbus, including this manual:

http://maemo.org/maemo_training_mate...m_Development/

But the problem is, although I understand it a little tiny bit, there doesn't seem to be a system dbus reference showing what signals are broadcast by the system (at least I couldn't find any such documentation).

So I was wondering if any of you knew of such a document, or if there isn't any such thing, telling me what python dbus code is needed to "catch" such information.

Well, I have another question, too (sorry!).

I'm able to get the current charge on the battery by using a simple program by Matan (which polls retu) but it isn't enough information. I also really need to know what the current draw on the battery is. So yesterday, on #maemo, Stskeeps and qwerty12 kindly pointed me in the direction of an application called Field Test Display (ftd) which shows this information, but I need to get this data via a CLI so I can document it. So if ftd gets it, then it must be accessible via the terminal somehow? At least I hope...

Any help on either of these issues is greatly appreciated!

Last edited by BrentDC; 2009-01-15 at 19:50.
 
Posts: 462 | Thanked: 550 times | Joined on Sep 2008 @ Moscow
#2
Well... See Advanced Power source (advanced_power_monitor, in fact), there I catch those bme's signals.
 
Posts: 42 | Thanked: 30 times | Joined on Jun 2008 @ Belgium
#3
You can use dbus-monitor in your terminal to show the dbus messages that are being sent on the dbus pipes. As it will show all dbus messages, I would suggest that you closes all applications you don't need in order to only get dbus messsages that you're interested in.
__________________
Python module to download subtitles. With Nautilus and Totem integration:
http://code.google.com/p/periscope


Looking for beta testers for a price comparison engine:
http://www.shoptimate.com
 
Posts: 462 | Thanked: 550 times | Joined on Sep 2008 @ Moscow
#4
Originally Posted by BrentDC View Post
But the problem is, although I understand it a little tiny bit, there doesn't seem to be a system dbus reference showing what signals are broadcast by the system (at least I couldn't find any such documentation).
Originally Posted by inoshishi View Post
You can use dbus-monitor in your terminal to show the dbus messages that are being sent on the dbus pipes. As it will show all dbus messages, I would suggest that you closes all applications you don't need in order to only get dbus messsages that you're interested in.
The only thing needed is
Code:
dbus-monitor --system
And there are more interesting options
 
BrentDC's Avatar
Posts: 903 | Thanked: 632 times | Joined on Apr 2008
#5
Thanks guys. This morning, just before I read your post inoshishi, I discovered dbus-monitor: wow, cool stuff. I successfully captured battery_plugged_in and battery_unplugged events. Now to figure out how to use the data!

@412b:
I've been using your Advanced Battery applet source a lot to help with things along the way (I even have the .1 release source saved ), but I couldn't figure out how exactly you interacted with dbus...I think I need to read up on dbus a lot more.

My program is coming along nicely though. It's up to the point where it prints out the average of the last 10 retu readings and converts it to a xx.x% number. The main framework is in place so that I can add things like deletion of rogue readings, a current_draw correction algorithm (if I can get the current draw somehow ), etc. Hopefully this will be the most accurate battery reading around!
 
Reply

Thread Tools

 
Forum Jump


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