public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* Battery information in sysfs for userspace tools
@ 2009-05-15  8:07 Yves-Alexis Perez
  2009-05-16 21:06 ` Alexey Starikovskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Yves-Alexis Perez @ 2009-05-15  8:07 UTC (permalink / raw)
  To: linux-acpi; +Cc: Evgeni Golov

Hi,

Evgeni Golov (CC:ed) is currently taking care of fixing acpitool wrt.
sysfs support (which is badly broken). 

Using the files in /sys/class/power_supply/BAT*/ we have some wondering
about units.

For the current rate, for example, we have:

corsac@hidalgo: grep . /sys/class/power_supply/BAT0/*now    
/sys/class/power_supply/BAT0/current_now:14415000
/sys/class/power_supply/BAT0/energy_now:44170000
/sys/class/power_supply/BAT0/voltage_now:12481000
corsac@hidalgo: grep . /sys/devices/platform/smapi/BAT0/*now
/sys/devices/platform/smapi/BAT0/current_now:1151
/sys/devices/platform/smapi/BAT0/power_now:14365

I'm a bit puzzled with the differences in current_now (the battery is
charging at that time), and don't really know if we can trust the units.

I would assume (in /sys/class/power_supply):
current_now to be in uA
energy_now to be in uWh
voltage_now to be in uV

as said in include/linux/power_supply.h

/*
 * All voltages, currents, charges, energies, time and temperatures in uV,
 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
 * stated. It's driver's job to convert its raw values to units in which
 * this class operates.
 */


and the current (dis)charging rate in W to be
(current_now/1.000.000)*(energy_now/1.000.000). But that gives, for an
end of charge, a charging rate of:

(14415000 / 1000000) * (12481000 / 1000000) = approx. 179.91362

which seems definitely wrong.

Where am I mistaken?

Btw this is on 2.6.29.2 on a Thinkpad T61, and tp-smapi is loaded.

Cheers,
-- 
Yves-Alexis

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-18 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15  8:07 Battery information in sysfs for userspace tools Yves-Alexis Perez
2009-05-16 21:06 ` Alexey Starikovskiy
2009-05-18 10:57   ` Yves-Alexis Perez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox