Jona Joachim <[email protected]> writes:

> Let's compare the outputs of apm and sysctl:
> 
> spaceman% apm && sysctl hw.sensors.acpibat0
> Battery state: high, 89% remaining, 74 minutes life estimate
> A/C adapter state: not connected
> Performance adjustment mode: cool running (1000 MHz)
> hw.sensors.acpibat0.volt0=10.80 VDC (voltage)
> hw.sensors.acpibat0.volt1=11.99 VDC (current voltage)
> hw.sensors.acpibat0.watthour0=19.53 Wh (last full capacity)
> hw.sensors.acpibat0.watthour1=0.98 Wh (warning capacity)
> hw.sensors.acpibat0.watthour2=0.20 Wh (low capacity)
> hw.sensors.acpibat0.watthour3=17.56 Wh (remaining capacity), OK
> hw.sensors.acpibat0.raw0=1 (battery discharging), OK
> hw.sensors.acpibat0.raw1=23460 (rate)
> 
> The unit of the discharge rate (hw.sensors.acpibat0.raw1) is not
> mentioned so I guess it's mW.
> If we calculate 17.56 Wh * 1000 / 23460 mW we get 0.74 hours. However
> apm reports 74 minutes remaining. I tried this several times and it
> always looks like apm assumes 1 h = 100 min.
> I was browsing a bit through the apmd source code but I couldn't find
> the exact place where apmd queries the battery.
> 
> Can anybody comment on this?

I have seen overestimated life estimate on my notebook. It is
consistent with your remark.

I have search a little on my STABLE tree the corresponding code.

On /usr/src/sys/dev/acpi/acpi.c, L1022:

                        pi->minutes_left = 100 * minutes / rate;

This 100 should be 60 according to your remark. The name of the
variable minutes is not well chosen, as it corresponds to the
remaining capacity of all the batteries, if I understand correctly the
code.

I will not have the time to test this modification before this
weekend.

-- 
Guillaume Pinot               http://www.irccyn.ec-nantes.fr/~pinot/

+ Les grandes personnes ne comprennent jamais rien toutes seules, et
c'est fatigant, pour les enfants, de toujours leur donner des
explications... ; -- Antoine de Saint-Exupiry, Le Petit Prince

()  ASCII ribbon campaign      -- Against HTML e-mail
/\  http://www.asciiribbon.org -- Against proprietary attachments

Reply via email to