Page MenuHomeFreeBSD

Make battery emptying rate available as sysctl variable
ClosedPublic

Authored by freebsdnewbie_freenet.de on Sep 8 2018, 9:40 AM.

Details

Summary

The emptying rate of a battery is an interesting value for monitoring the laptops current status. This patch makes it available as a sysctl variable.

Test Plan

sysctl hw.acpi.battery.rate
hw.acpi.battery.rate: 5846

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

I think this diff is probably fine. In general the 'acpiconf -i <x>' interface tends to be more informative, and userland applications wanting to query battery info should be using the ACPIIO_BATT_* ioctls instead of sysctls.

My intention was to simplify the querying of current rate mainly for scripts and userland programs. Using acpiconf -i <x> in a script occured a bit cumbersome to me because for more than one battery, one has to iterate over the result of hw.acpi.battery.units and parse the acpiconf's output to get the actual rate.
Also, the most (hm, i think actually all) FreeBSD compatible monitors which sources i've seen were using the sysctls interface and not the ACPIIO_BATT_* ioctls, so there would be a lower threshold to add the information about current rate.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 30 2018, 12:19 AM
This revision was automatically updated to reflect the committed changes.