CVSROOT:        /cvs
Module name:    src
Changes by:     k...@cvs.openbsd.org    2021/03/25 06:18:27

Modified files:
        sys/dev/fdt    : cwfg.c 

Log message:
Provide apm(4/arm64) with battery information

apm merely provides an all zero/unknown stub for those values, e.g. apm(8)
output is useless.

Hardware sensors however provide this information:

hw.sensors.cwfg0.volt0=3.76 VDC (battery voltage)
hw.sensors.cwfg0.raw0=259 (battery remaining minutes)
hw.sensors.cwfg0.percent0=58.00% (battery percent)

Make cwfg(4) copy those over using apm_setinfohook() for apm to show it:

Battery state: high, 58% remaining, 259 minutes life estimate
A/C adapter state: not known
Performance adjustment mode: auto (408 MHz)

In cwfg's update routine, to keep values coherent, always reset them to
zero/unknown and only set those that came from a valid reading.

Input OK jca

Reply via email to