OpenBSD battery state - BSD
bsdkeith
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. :)
z3bra
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?
bsdkeith
I have found sysctl hw.sensors.acpibat0 to get just the battery info.
jvarg
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}
Mafia
yep. Found it back in '12 :)
[Image: openbsd___lol_by_unixmafia-d5fpy43.png]
bsdkeith
Thanks for your post jvarg, I will give that a go.




Members  |  Stats  |  Night Mode