nixers
OpenBSD battery state - Printable Version
+- nixers (https://nixers.net)
+-- Forum: Operating Systems & Administration (https://nixers.net/Forum-Operating-Systems-Administration)
+--- Forum: BSD (https://nixers.net/Forum-BSD)
+--- Thread: OpenBSD battery state (/Thread-OpenBSD-battery-state)


OpenBSD battery state - bsdkeith - 27-04-2015

If, like me, you don't/didn't know how to get info about your battery state, at the command line, try these :-

sysctl hw.sensors
apm -av
apm -bv

Hope that is useful to someone else. :)


RE: OpenBSD battery state - z3bra - 27-04-2015

I'm sure it will be ;) Isn't there a file managed by the kernel exposing the battery state like /sys/power_supply/BAT0/capacity do on linux?


RE: OpenBSD battery state - bsdkeith - 28-04-2015

I have found sysctl hw.sensors.acpibat0 to get just the battery info.


RE: OpenBSD battery state - jvarg - 10-07-2015

you can echo the percentage like this:

battatm=$(sysctl -n hw.sensors.acpibat0.amphour3 | sed s/.A.*//)
battfull=$(sysctl -n hw.sensors.acpibat0.amphour0 | sed s/.A.*//)
load=`echo "${battatm} / ${battfull} * 100" | bc`
echo ${load}


RE: OpenBSD battery state - Mafia - 11-07-2015

yep. Found it back in '12 :)
[Image: openbsd___lol_by_unixmafia-d5fpy43.png]



RE: OpenBSD battery state - bsdkeith - 11-07-2015

Thanks for your post jvarg, I will give that a go.