Re-writing the _BIF and _BST ACPI methods…

A couple of days ago my new laptop arrived. A nice shiny new Lenovo 3000 N100. Most stuff worked out of the box (well done kernel guys), but most important to me: the battery ACPI code was really bad. So I got no rate information and a really bad approximation of the charge level. For a bloke working on gnome-power-manager, this was really bad news. Windows XP just gave me the percentage charge also, so this wasn't a Linux bug.

Last night I decompiled the DSDT and was surprised to find no errors or warnings. Hmm. So I looked closely at the source. LENOVO were just hardcoding values rather than querying the smart battery which is what they are meant to do. And when they were querying the battery, the return value was being processed incorrectly.

So I re-wrote the _BIF and _BST ACPI methods to actually interface with the hardware in a sane way. Bear in mind I only had a copy of the generic ACPI spec, but managed to figure out most of the undocumented embedded controller interface (EC0). I'll formally write up what I found when I get a chance.

So now, I have a really custom DSDT that provides me with accurate voltage, charge and rate information that works really well. If anyone from LENOVO is reading this, then please get one of your BIOS engineers to call me on my mobile or email me. I would love for this to be included in a BIOS update to fix all the other Windows XP and Linux laptops out there. I've also got a fully commented (well the battery bits anyway) DSDT for any LENOVO owners wanting to hack even more than I've done.

Also, I had to recompile a custom kernel with this patch just to enable dsdt loading into the kernel using an initrd. Ubuntu make this super-duper easy I'm told, but working with Fedora makes this a pain in the backside. Anyone with contacts to IBM/Lenovo then please send them a link to this post or get them to email me. In the words of Mattew Garrett: “0 out of 10 – See Me”

Published by

hughsie

Richard has over 10 years of experience developing open source software. He is the maintainer of GNOME Software, PackageKit, GNOME Packagekit, GNOME Power Manager, GNOME Color Manager, colord, and UPower and also contributes to many other projects and opensource standards. Richard has three main areas of interest on the free desktop, color management, package management, and power management. Richard graduated a few years ago from the University of Surrey with a Masters in Electronics Engineering. He now works for Red Hat in the desktop group, and also manages a company selling open source calibration equipment. Richard's outside interests include taking photos and eating good food.

One thought on “Re-writing the _BIF and _BST ACPI methods…”

  1. It's a pain because it's supposed to be a pain, if everybody loaded custom dsdt' DaveJ would have a hell of a task, besides the corret thing to do would be to get the changes upstream so it would work for everybody (that is if the damn vendor didn't do it right in the first place).

Comments are closed.