OpenBSD battery state - BSD

Users browsing this thread: 1 Guest(s)
bsdkeith
Long time nixers
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
Grey Hair Nixers
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
Long time nixers
I have found sysctl hw.sensors.acpibat0 to get just the battery info.
jvarg
Members
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
Long time nixers
yep. Found it back in '12 :)
[Image: openbsd___lol_by_unixmafia-d5fpy43.png]
bsdkeith
Long time nixers
Thanks for your post jvarg, I will give that a go.