Battery Life Estimation: First try

Martin Dengler martin at martindengler.com
Sat May 3 09:32:52 EDT 2008


On Fri, May 02, 2008 at 10:07:25PM -0400, Richard A. Smith wrote:
> Martin Dengler wrote:
> >Martin
> >
> >1. Obviously I wouldn't want to submit my hack as a patch, but what
> >should be done?  Should we add this logic to the Hal so I can retrieve
> >it via dbus?
> 
> Dunno.  dbus should perhaps be able to feed up the ACR value when 
> requested but I don't think its the place for the math.  How does gnome 
> power manager do it?.

Based on a g-p-m presentation[1] and the results[2,3] of my 5-10 minutes
of looking through the g-p-m source, it seems that g-p-m relies on the
HAL making "battery.remaining_time" (time-in-seconds) available.  So
it would appear that a hal addon/backend would be the place for the math,
but I think I've made clear how much experience I have in these
matters :).

> >2. when I unplugged the AC and my XO/battery went from charging to
> >discharging, I got a divide-by-zero error:
> 
> Integer math issue.  I was watching for the avg draw to be zero but not 
> the instantaneous draw.  I added a check for DRAW_INST to be zero as 
> well.  I don't have any XO's with me though so I can't test.

Thanks for the problem-pointer for the incredibly lazy (me).

Martin

1. http://people.freedesktop.org/~hughsient/public/gnome-power-manager.pdf

2. Line 315 in gpm-cell.c:
   http://svn.gnome.org/viewvc/gnome-power-manager/trunk/src/gpm-cell.c?annotate=2786

3. http://www.gnome.org/projects/gnome-power-manager/hal.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080503/6cf78645/attachment.sig>


More information about the Devel mailing list