Go straight to the source. The /proc file structure!!
On my ASUS laptop (that I'm writing this message on):
Code:
$ cat /proc/acpi/battery/BAT0/state
present: yes
capacity state: ok
charging state: charged
present rate: 0 mW
remaining capacity: 35673 mWh
present voltage: 12386 mV
$
$ cat /proc/acpi/battery/BAT0/info
present: yes
design capacity: 51260 mWh
last full capacity: 36817 mWh
battery technology: rechargeable
design voltage: 11100 mV
design capacity warning: 5126 mWh
design capacity low: 506 mWh
cycle count: 0
capacity granularity 1: 506 mWh
capacity granularity 2: 506 mWh
model number: F8---24
serial number:
battery type: LIon
OEM info: ASUSTEK
That should be fairly reliable as the /proc filesystem is a virtual filesystem maintained by the kernel. I would believe that output. If the kernel doesn't know about a Smart battery, or your battery isn't SMART, you will simply see less file/directories under the /proc/acpi folder (assuming you have ACPI support at all
).
Run some tests with the battery. Change the power draw (put on a flash video
). If the power-drain goes up and the capacity goes down - you are at least seeing that the basics work.
I guess battery monitoring software checks stuff like the design capacity of the battery vs. actual capacity. Naturally you have to fully drain the battery charge to check the current capacity (accurately). Not sure what else it might have access to?
Hope that's useful!
Mr Gates