gnome-power-manager time remaining profile code

GNOME Power manager often sucks at predicting the amount of battery time you have left. To fix this, I've been working on a new time remaining profile class for gnome-power-manager. I'm using a self-adjusting discharge and charge profile that adjusts for the specific battery and computer that's being used, and also how it is being used. Why is this important?

  • BIOS's frequently lie to us pretty badly.
  • So called “smart” battery discharge chips are often really, really dumb.
  • Batteries sometimes have old or degraded cells that really don't hold much charge.
  • Batteries discharge faster if you are typing than if the computer idle. There's no point knowing how much time you have when idle, users want how much time they have when the computer is being used like normal.
  • Some batteries (like the OLPC or N800) don't give us much useful information and we have to be a bit clever.
  • Some BIOSes from Lenovo are REALLLLLY REALLLLLY BROKEN.
  • Sometimes machines with multiple batteries discharge in series or parallel, which completely change the way we calculate total capacity, and it's often pretty random when they change over.
  • We have a lot of floating point processing power available for some fairly advanced statistics when we are in userspace, rather than in the hardware or in the kernel.

So basically I suggest ignoring the battery capacity, and just watch how long in seconds it takes to change by each percentage point. Doing some clever rate calculations, and with enough duplicate data (which only takes 2 or 3 charge discharge cycles) the time is pretty easy to get. And, wow, it works – remarkably accurately, and more and more accurate with each charge/discharge cycle.


Sub-screenshot of data-profiling

Main problem: How do we prevent collecting bad data? Lots of things break the accurate profiling.

  • The OpenGL screensaver starting
  • The laptop screen doing DPMS off
  • Beagle doing a re-index while charging (large effect)
  • Lots of CPU load (like a kernel compile)
  • Large temperature variations.

So far I'm just rejecting any data collected during a load > 10%, or when the backlight is off, or while the session is idle. Ideally what I would like is are [Profile Start] and [Profile End] buttons that turn off all the power saving stuff and beagle/trackerd cache updates just until we have some sensible data, which we only need to do once. Ideas welcome on how to integrate this with any possible UI.

All of the new stuff is already in gnome-power-manager trunk, but some bits won't work unless you have pretty similar hardware to mine – plus it's got pretty minimal testing. The time remaining in the UI is currently all still based on the old method, but this new method will probably be selectable via gconf. So things are getting better.

autofoo-1.10 and evolution

I'm running Fedora Rawhide. I'm having problems building packages such as HAL (specifically make distcheck) using aclocal-1.10 and automake-1.10. If I manually use the *-1.7 packages things build like they used to, but of course 1.10 is always chosen over 1.7 to build rpm's and thus the rebuild fails like this:

gtk-doc: Compiling scanner
mkdir .libs
 gcc -g -O2 -Wall -Wchar-subscripts -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -c hal-scan.c  -fPIC -DPIC -o .libs/hal-scan.o
hal-scan.c:5:25: error: glib-object.h: No such file or directory
hal-scan.c:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'libhal_psi_get_type'
hal-scan.c:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'hal_device_store_get_type'

Anyone come across this before, or have any ideas on how to fix this?

Also evolution has been broken on rawhide for the last week or so for me. Don't you just love rawhide.

Handling GNOME Bugs

The new GNOME crash handler is great. Unfortunately I get quite a few duplicates every day of a particular bug that has recently been fixed. I'm sure I'm not the only developer with this problem of fighting with bugzilla.

Perhaps the wording of the crash dialog should say:

What were you doing when the application crashed?
You should aim to provide developers with enough information to replicate the crash, and not details about what you are drinking.
Please can you check the product bugzilla page to check for duplicates before sending crash details. [Check Now]

Or, even better:
A similar bug has already been reported and the developers have released a fix. Please make sure your system is up to date, and if so file this in your distribution bug tracker.

Or at least:
The application crashed and you have no debugging symbols; this bug report is both a waste of time for you and the application developer who will just ask for a better stacktrace with debugging symbols.

Or in an ideal world:
The application crashed and you have no debugging information available. The required files have now been automatically downloaded, and if the bug happens again your bug report will be sent to developers.

Epiphany and print to PDF

Epiphany is the best browser available for Linux in my opinion, as it's nicely integrated with GNOME, quick to start and is really easy to use.

One major feature is missing: Print to PDF… It gives me the option to print to PS, but I can hardly send a huge PS file to my parents. How come the GNOME web browser can't give me the printing options that all the other GNOME software gives me?

There are two bugs open, one with a trivial patch, so maybe we can fix this for GNOME 2.18?

SVN and ignoring files

Today I branched gnome-power-manager for 2-18. Expect a fair bit of refactoring on trunk, and the self test code to grow in complexity. SVN is different. Why is is so hard to set svn ignore properties? It seems so difficult compared to CVS. Google isn't being helpful either. How for instance do I set the svn:ignore property on “test/.libs” without upsetting the other ignored status of the other files? There must be a GUI for this somewhere. Any ideas?

Back from FOSDEM

Well, FOSDEM is over and it was fantastic to meet so many people. I would have liked to travel on the Thursday and Monday, but Uni constraints meant I had to do a fly-by visit. Many thanks for Nokia for paying for the hotel and Eurostar, as otherwise I wouldn't have been able to be there.

The OHM talk went well, with lots of constructive feedback and positive comments. Expect more wiki and mailing list stuff in the next few weeks. Although the embedded guys seem to be keen on OHM, some details and problems will need to be ironed out. Expect some fairly animated discussions on the mailing list.

I've also experienced a few people greeting me and thanking me for working on g-p-m. That meant quite a lot to me, as one happy user saying thanks in person overcomes about 50 NEEDINFO bugzilla entries, and makes it all worthwhile. So, whoever you were, thanks.

I have exams fairly soon, I'll really have to reduce the amount of OSS work I am doing…

FOSDEM: Open Hardware Manager

Tomorrow I'm off to FOSDEM. I'm introducing a BOF on Open Hardware Manager in the embedded room on Sunday. OHM is a small open source system daemon which uses HAL and abstracts out common hardware management tasks such controlling heat dissipation and power consumption on embedded devices.

If any embedded people want to find out what all this stuff is about, then please either come to the BOF or buy me a beer in the evening.

Rhodri 4GB Saga 3

Spent some more time hanging out with Rhodri, and answering some of the Ubuntu questions he had.

First, his FAT32 fixed disk was not showing up in the menus, and for quickness I just added an entry in fstab, but wondered why it was not showing up in the menus. In FC6 I know you can just edit the HAL FDI file to enable this, but this didn't work on Edgy.

He had created several 7Gb iso images and put them on his ext3 home. He then tried to copy them to the new FAT32 partition on another disk, but every time Nautilus would crash halfway through.

Of course, FAT32 only supports up to a file size of 4Gb, but we were not told this either by nautilus or by the command line using mv.

This has been reported before, bug #365885 but has had no love yet. What about a new dialog like “You are trying to copy a large file to a partition type that cannot support this. [skip] [skip all] [cancel]” Better wording appreciated.

Bugs like this rarely affect die hard linux fans with all ext3/xfs partitions but probably is hit frequently with people new to Linux and dual booting. Anybody already have a patch for this or do I have to do it?

WPA-PSK, it can't be that hard, right?

So, I spend another few hours with Rhodri today, helping to set up networking with Ubuntu Edgy and a new zd1211 based USB2 networking device. This all should “just work” with the new zd1211rw driver in the kernel. I spent about an hour using my laptop as a wireless->wired bridge which was no mean feat, as NetworkManager didn't do this for me, and the redhat network scripts don't do WPA. After applying the updates everything worked a little better. After about 2 hours of debugging, I came to the conclusion that either the edgy updated kernel does not have the latest zd1211rw code required for WPA, or that the Ubuntu wpa_supplicant was in some way broken. I admitted defeat, and changed the access point to be WEP with MAC filtering and promised I would find the proper solution. So lazyweb, how do you get zd1211rw to work with WPA-PSK? Thanks.