-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathacpibat
executable file
·33 lines (27 loc) · 1.26 KB
/
acpibat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
## $Id: acpibat,v 1.2 2007/04/25 00:47:32 yozo Exp $
## echo "$0"
SYSCTL="/sbin/sysctl -n"
lastfull=`${SYSCTL} hw.sensors.acpibat0.watthour0 | sed 's/[^0-9]*\([0-9.][0-9.]*\).*$/\1/'`
remaining=`${SYSCTL} hw.sensors.acpibat0.watthour3 | sed 's/[^0-9]*\([0-9.][0-9.]*\).*$/\1/'`
charging=`${SYSCTL} hw.sensors.acpibat0.raw0`
powersupply=`${SYSCTL} hw.sensors.acpiac0.indicator0`
temperature=`${SYSCTL} hw.sensors.acpitz0.temp0`
echo -n "battery: ${remaining} / "
echo -n "${lastfull} ("
bc -e "${remaining} * 100 / ${lastfull}" -e quit | tr -d '\n'
echo "% remaining)"
echo -n "charging: ${charging} | "
echo -n "powersupply: ${powersupply} | "
echo "temperature: ${temperature}"
## /sbin/sysctl -a | grep -i acpi
## hw.sensors.acpibat0.volt0=11.10 VDC (voltage), OK
## hw.sensors.acpibat0.volt1=12.57 VDC (current voltage), OK
## hw.sensors.acpibat0.watthour0=22.32 Wh (last full capacity)
## hw.sensors.acpibat0.watthour1=0.00 Wh (warning capacity)
## hw.sensors.acpibat0.watthour2=0.12 Wh (low capacity)
## hw.sensors.acpibat0.watthour3=16.74 Wh (remaining capacity)
## hw.sensors.acpibat0.raw0=2 (battery charging), OK
## hw.sensors.acpibat0.raw1=2476 (rate)
## hw.sensors.acpiac0.indicator0=On (power supply)
## hw.sensors.acpitz0.temp0=36.95 degC (zone temperature)