battery on notebook

Luke Yelavich themuso at themuso.com
Wed Sep 29 01:09:18 EDT 2004


On Wed, Sep 29, 2004 at 01:57:31PM EST, Juan Hernandez wrote:
> Hello everyone, I have a sony Vaio fxa53, I'm running fedora c2, kernel 2.6.8.1 that I rpm upgraded from the speakup ftp.  I'd like to know how I can determine how much life my battery has?  thanks

Before you can determine how much battery you have left, you need to work out
whether you are using ACPI or apm. To do this, find out whether there is a
directory under /proc called acpi. Do the following:

ls /proc/acpi

If you get a few items back, you have acpi installed. To find out whether you
have apm running, do the following.

ls /proc/apm

If you get a response back that isn't an error message, you have apm. Note
that you can't have both at the same time. You can only have one or the other.

If you have apm, it is quite easy to determine battery life. Simply type apm
which will give you all the info you need to know.

However, ACPI is a little more complicated. You then have to work out whether
you have the battery module either loaded, or compiled into your kernel.
My guess is that it will be a module.

To work this out, try and go to the /proc/acpi/battery directory.

cd /proc/acpi/battery

If this doesn't exist, you will need to load the battery module. I think the
module name is battery, so do the following.

modprobe battery

All being well, the /proc/acpi/battery directory should exist now. Under this
directory, there will be one or more directories. If your laptop has 2 or more
batteries, there will be a directory for each battery giving you information
about the batteries. The best way to find out the amount of life left in the
battery is to do the following.

luke at luke-laptop:~$ cat /proc/acpi/battery/BAT0/state
present:                 yes
capacity state:          ok
charging state:          charged
present rate:            0 mW
remaining capacity:      42420 mWh
present voltage:         12376 mV

The second last line is what you are interested in. It gives you the remaining
capacity, but doesn't give it to you in percentages.

I hope this helps, and if anybody knows how to check ACPI battery capacity
and display a percentage, I would love to know.
 
Luke




More information about the Speakup mailing list