Comment 30 for bug 384304

Revision history for this message
Javier Martín (jmartinj) wrote :

Attached is a patch to fix this bug. The problem is in function dkp_daemon_get_on_battery_local of dkp-daemon.c. The logic is "we're on battery as soon as _any_ battery goes discharging", but often batteries have troubles reporting their charging/discharging status and just say "unknown" (at least in my two laptops, an IBM T42 and an Asus Eee 901), so relying on the batteries' status to figure out wether we are plugged in or not is not acceptable. Rather, we should ask the AC power device directly and change the above logic to: "we're on battery as soon as _any_ AC supply goes online".

A patch is attached. It applies on 011-1ubuntu1. I would report it upstream if I knew how.

I also uploaded the binaries to a PPA. To test this fix:

sudo add-apt-repository ppa:jmartinj/dkp
sudo apt-get update
sudo apt-get upgrade